You are here

The OpenMx website will be down for maintenance from 9 AM EDT on Tuesday, September 17th, and is expected to return by the end of the day on Wednesday, September 18th. During this period, the backend will be updated and the website will get a refreshed look.

mxTryHard status codes

10 posts / 0 new
Last post
Rachel's picture
Offline
Joined: 02/08/2012 - 11:08
mxTryHard status codes

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

CharlesD's picture
Offline
Joined: 04/30/2013 - 11:05
Thanks Rachel. The first bug

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.

Rachel's picture
Offline
Joined: 02/08/2012 - 11:08
Thank you!

Thank you!

martonandko's picture
Offline
Joined: 02/19/2015 - 06:55
Expirience same problem

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)?

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
Status code = -1 means

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()?

martonandko's picture
Offline
Joined: 02/19/2015 - 06:55
Thanks for having a look at

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:

Begin fit attempt 1 of at maximum 2 tries
 
 Lowest minimum so far:  461.211751950297
 
 Not all eigenvalues of hessian are greater than 0: 559.193020473922, 486.393117628652, 204.302637390566, 187.97870749209, 174.565171935069, 127.448215232486, 34.6394063711714, 4.85183481710131, 1.37182372473253, -0.127544032337779
 
Begin fit attempt 2 of at maximum 2 tries
 
 Lowest minimum so far:  461.211751950279
 
 OpenMx status code 1 greater than 0
 
 Not all eigenvalues of hessian are greater than 0: 559.192121639248, 486.392579488029, 204.304599125184, 187.979472270581, 174.565930769942, 127.448041794442, 34.6396697751378, 4.8521695638418, 1.37244146991232, -0.126964546464526
 
Retry limit reached
Estimate confidence intervals for imperfect solution
 
 
Start values from best fit:
0.767557125047236,0.169527920231489,0.414497889243009,0.543614188916936,0.728527002372227,0.505322379565154,0.118637216479181,-0.0932594170628762,1,1

@output$status returns:

$code
[1] -1
 
$status
[1] 0

In case of a model where it says, solution found:

Begin fit attempt 1 of at maximum 11 tries
 
 Lowest minimum so far:  461.211751950294
 
 OpenMx status code 1 greater than 0
 
Begin fit attempt 2 of at maximum 11 tries
 
 Lowest minimum so far:  461.211751950276
 
 OpenMx status code 1 greater than 0
 
Begin fit attempt 3 of at maximum 11 tries
 
 Lowest minimum so far:  461.211751950274
 
Solution found
 
Estimating confidence intervals
 
 
Start values from best fit:
0.767557199351073,0.169527720018016,0.414497827985777,0.543614118267592,0.728526940730898,0.505322361547715,0.11863739923075,-0.0932593099645859,1

But the status is the same as the previuos model:

$code
[1] -1
 
$status
[1] 0
AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
status code is probably spurious

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.

martonandko's picture
Offline
Joined: 02/19/2015 - 06:55
Is there a work around?

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.

CharlesD's picture
Offline
Joined: 04/30/2013 - 11:05
Thanks for pointing these

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! :)

CharlesD's picture
Offline
Joined: 04/30/2013 - 11:05
Any chance you can supply a

deleted my comment and taking a look