Closed salvatoj closed 2 years ago
Hi Jessica
It is not a good idea to make an ordered factor out of a definition variable. Essentially, whatever value it has will be used in the model to define or adjust a path coefficient. If it's a factor, it won't know what to do with it. Evidently, this is an issue that could use a more informative error message...
Thank you Mike! Very helpful to know. I will proceed with the binary 0/1 coding.
The error is from umxPlotGxE(m1)
I guess the right thing to do is to stop umxGxE
coping with the factor input to catch this earlier on, so I did that now.
mzData = subset(twinData, zygosity == "MZFF")
> dzData = subset(twinData, zygosity == "DZFF")
> m1 = umxGxE(selDVs= "wt", selDefs= "obese", sep= "", dzData= dzData, mzData= mzData, tryHard= "yes", dropMissingDef = TRUE)
Error: Definition vars (selDefs) must be numeric (not, e.g. factor)
I would like to use umxGxE with a binary definition variable (moderator), and a continuous outcome. However, when I apply MxFactor to my definition variable, the model runs but throws an error ("Error incurred trying to run umxSummary non-numeric argument to binary operator"). I then tried to see if I got the same error if I coded the definition variable as numeric (0/1). This resulted in no error, but I'm concerned that the variable type is not being treated correctly in the model. Might there be any advice on how to proceed?
Reproducible example with toy data below -