Hello,
I am trying to conduct a multivariate sex-limitation model. I am not sure why, but when I run the exact same command I get different results in each run (and in some of the runs, the results don't really correspond with the raw data and don't make sense).
I assume that this is the result of an unstable solution. However, I don't get any warning messages that indicate there is anything wrong, or that could direct me what to do.
The script is attached. Do you have an idea what could be the problem?
Thank you very much,
Lior
selDVs=c("var_x", "var_y") model_Nonscalar <- umxSexLim( name = "sexlim", selDVs = selDVs, mzmData,dzmData,mzfData, dzfData,dzoData_org, sep = "_", A_or_C = "A", #free A sexlim = "Nonscalar", dzAr = 0.5, dzCr = 1, autoRun = getOption("umx_auto_run"), tryHard = "yes", optimizer = NULL )
The reason why you're seeing different results each time is that you have
tryHard="yes"
, meaning that if the first attempt at fitting the model doesn't lead to a satisfactory solution, then the free parameters will be randomly perturbed, and another attempt will be made, and the cycle may repeat (see documentation formxTryHard()
). You can ensure you'll get the same results every time if you useset.seed()
(with an integer argument) before callingumxSexLim()
.Even so, the fact that
mxTryHard()
isn't converging on the same solution each time suggests that this is an unusually difficult optimization problem, or perhaps, that the model is unidentified. The latter seems unlikely, since the model was automatically constructed by umx, but there could be a bug. You should maybe contact Tim Bates, the umx maintainer.