Skip to content

Instantly share code, notes, and snippets.

@tbates
Last active June 2, 2017 14:24
Show Gist options
  • Save tbates/d82fc00a979d8f467f0c3cc6effa70b6 to your computer and use it in GitHub Desktop.
Save tbates/d82fc00a979d8f467f0c3cc6effa70b6 to your computer and use it in GitHub Desktop.
# ============================
# = How heritable is height? =
# ============================
require(umx)
data(twinData) # ?twinData from Australian twins.
# Pick the variables
selDVs = c("ht1", "ht2")
mzData <- twinData[twinData$zygosity %in% "MZFF", ]
dzData <- twinData[twinData$zygosity %in% "DZFF", ]
# -2ll used to be 9659
# All three optimizers code RED
m1 = umxACE(selDVs = selDVs, dzData = dzData, mzData = mzData, opt= "NPSOL")
# -2 × log(Likelihood) -11985.57 (df=4)
# | | a1| c1| e1|
# |:---|----:|----:|----:|
# |ht1 | 0.92| 0.14| 0.36|
# Warning message:
# In model 'ACE' Optimizer returned a non-zero status code 6. The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)
m1 = umxACE(selDVs = selDVs, dzData = dzData, mzData = mzData, opt= "SLSQP")
# Was returning start-value estimates, still returns Code RED (6)
m1 = umxACE(selDVs = selDVs, dzData = dzData, mzData = mzData, opt= "CSOLNP")
# Code red, solution OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment