# NOT RUN {
require(umx)
data(twinData)
umx_set_optimizer("SLSQP")
twinData$age1 = twinData$age2 = twinData$age
selDVs = "bmi"
selDefs = "age"
mzData = subset(twinData, zygosity == "MZFF")[1:100,]
dzData = subset(twinData, zygosity == "DZFF")[1:100,]
m1 = umxGxE(selDVs= "bmi", selDefs= "age", sep= "", dzData= dzData, mzData= mzData, tryHard= "yes")
# }
# NOT RUN {
# Select the data on the fly with data= and zygosity levels
m1 = umxGxE(selDVs= "bmi", selDefs= "age", sep="", dzData= "DZFF", mzData= "MZFF", data= twinData)
# ===============================================================
# = example with Twins having different values of the moderator =
# ===============================================================
twinData$age1 = twinData$age2 = twinData$age
tmp = twinData
tmp$age2 = tmp$age2 +rnorm(n=length(tmp$age2))
selDVs = "bmi"
selDefs = "age"
mzData = subset(tmp, zygosity == "MZFF")
dzData = subset(tmp, zygosity == "DZFF")
m1 = umxGxE(selDVs= "bmi", selDefs= "age", sep= "", dzData= dzData, mzData= mzData, tryHard= "yes")
# ====================================
# = Controlling output of umxSummary =
# ====================================
umxSummaryGxE(m1)
umxSummary(m1, location = "topright")
umxSummary(m1, separateGraphs = TRUE)
m2 = umxModify(m1, regex = "am_.*", comparison = TRUE, tryHard = "yes")
# umxReduce knows how to test all relevant hypotheses for GxE models,
# reporting these in a nice table.
umxReduce(m1)
# }
Run the code above in your browser using DataLab