Dear all,
I have been running a model within a loop over several variables, which does not converge well for all variables. Therefore, I applied mxTryHard. There are two things I noticed:
1) for models that run well without calling mxTryHard the best fit does not seem to change using mxTryHard, but the status code changes from 0 to -1
> fit1 <- mxRun(model,intervals =F)
> fit1$output$Minus2LogLikelihood
[1] 4595.342
> fit1$output$status
$code
[1] 0
$status
[1] 0
fit2<-mxTryHard(model,intervals=F)
> fit2$output$Minus2LogLikelihood
[1] 4595.342
fit2$output$status
$code
[1] -1
$status
[1] 0
2) even when I set "intervals=F" (like in the example above) the mxTryHard option computes intervals.
Can you help?
Thanks in advance
Thanks Rachel. The first bug you mention should already be resolved in the development version of OpenMx. The second is a good point, I will adjust this. These changes will be available in the next release, or by building OpenMx from source.
Thank you!
Hi all,
I experience the same status code = -1 problem in case of any model I run with mxTryHard, be it a model that results in "Solution found", or a model that results: "OpenMx status code 1 greater than 0; Not all eigenvalues of hessian are greater than 0; Retry limit reached, "
I'm running OpenMx version: 2.3.1 [GIT v2.3.1], R version: R version 3.2.1 (2015-06-18), Platform: x86_64-w64-mingw32, Default optimiser: NPSOL, installed from the website.
Does this mean both models converged (MxStatus Green)?
Status code = -1 means premature termination of the optimizer, so I don't think any models converged. Based on the information in your post, I'm not sure what's going on, though. Could you copy-paste the messages printed to the screen by
mxTryHard()
?Thanks for having a look at it!
Limiting the extra runs to 1 to supress output (output the same for 10 extra runs), mxTryHard returns:
@output$status returns:
In case of a model where it says, solution found:
But the status is the same as the previuos model:
Hmm. OK, it would appear that the optimizer is NOT terminating prematurely. I would guess that the second model in your post converged, but that the first one (with just one extra try) didn't.
I think the status code of -1 is spurious, and due to a bug.
Thanks for the information! mxTryHard really seems like a nice tool, hope the bug can be fixed easily. Is there a way to identify mxTryHard runs which terminate with a solution, other than the status code for the time being?
Two other interesting things, which might be bugs is:
-if I rerun a fitted model, which was fitted with mxTryHard with the simple mxRun command, the status code stays -1 for all models.
-if I don't include the "intervals = T" command in the mxTryHard command, and rerun the fitted model with the simple mxRun command with the "intervals = T" command, then it doesn't calculate the confidence intervals.
Thanks for pointing these out, they all stem from the one issue which needs to be fixed really. For the moment, a work around would be to use omxGetParameters() to extract the estimates from the mxTryhard with intervals=F solution, and omxSetParameters() to assign these values to an unfitted model, then fit this with mxRun and intervals=T. Or just pay attention to whether mxtryhard reports 'solution found' or not - this indicates that the fit prior to estimating confidence intervals was accepted, and confidence interval estimation won't change this. Sorry for the fuss! :)
deleted my comment and taking a look