tbates / umx

Making Structural Equation Modeling (SEM) in R quick & powerful
https://tbates.github.io/
44 stars 17 forks source link

umGxE Add extended version (allow T1mod != T2mod) #125

Closed tbates closed 4 years ago

tbates commented 4 years ago

umxGxE currently assumes twins share the moderator (e.g all(T1mod == T2mod)==TRUE

Under the assumption that the latent causes of the moderator do not exert a moderated influence on the DV, it is legitimate to allow non-shared moderators, as long as both twins have their co-twin's moderator regressed out of their DV score (in addition to regressing out their own score on the moderator from their DV).

i.e. the moderated univariate model is run on residuals(DV ~ T1mod + T2mod)

TODO

notes

umxGxE used to support regressing mod and mod^2 out of the DV. Now it will support only mod, not mod^2 when in non-shared moderator mode. This is not a great loss as most people don't regress powers of the moderator, and can be added if needed, perhaps as part of a highly flexible formula-based moderator approach, like #116

tbates commented 4 years ago

Test example, just adding noise to Twin 2 moderator ...

tmp = twinData
tmp$age1 = twinData$age
tmp$age2 = tmp$age1 +rnorm(n=length(tmp$age1))
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")
name Estimate Std.Error
a_r1c1 0.700 0.041
c_r1c1 0.000 0.342
e_r1c1 0.293 0.030
am_r1c1 0.002 0.001
cm_r1c1 0.000 0.008
em_r1c1 0.006 0.001
mean 20.896 0.050
betaSelf_r1c1 0.013 0.009
betaCoTwin_r1c1 0.008 0.009