You are here

Optimizer status code

2 posts / 0 new
Last post
mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Optimizer status code

Elements of model@output$status

Each of the output codes should report an appropriate error message at the end of evaluation of the mxRun() statement.

@output$status[[1]]

This status element is returned from the optimizer (NPSOL). 
A value of 0 means a successful optimization--no error returned.
A value of 1 means that an optimal solution was found, but that the sequence of iterates did not converge.  There are several reasons this can happen, including starting at the correct values.  It generally does not indicate a problem. These estimates can generally be considered correct solutions, so this code is labeled (Mx status GREEN).
A value of −1 means that the optimizer found itself stuck in a location where the objective function could not be calculated, and could not find a way out. This most often happens if the starting values make the calculation impossible.
A value of 2 or 3 means that the bounds or constraints, respectively, could not be satisfied.
A value of 4 means that the iteration limit was reached, with no solution found. You can use mxOptions() to set a higher iteration limit, or just run mxRun() using the output –it will restart from the most recent set of estimates, and make another run of the same number of iterations.
A value of 6 means that optimality conditions could not be reached, and the optimizer could find no way to improve the estimate.  It often implies either a mistake in the model specification or starting values in an intractable range. The estimates resulting from this run are NOT optimal estimates, and should not be treated as solutions, so this code is labeled (Mx status RED).
Any other status codes should be reported.

@output$status[[2]]

output$status[[2]] returns the error code from the OpenMx C backend which is usually −1, if an error has occurred. This indicates that some aspect of the objective calculation could not be completed at the current location.

@output$status[[3]]

The third element of status provides detailed information on why the objective function could not be calculated. One example is:

@output[[3]] ["Covariance matrix is not positive-definite."]

<ul>
    <li>Look at your starting values. if you have used starting values 1s, you are building an initial expected covariance that is exactly singular. At the first iteration, OpenMx can't invert the expected covariance matrix, and crashes.</li>
    <li><strong>Solution</strong>: Try changing your starting values (say, by making all of the covariances and free regressions 0.5) and see if it runs.</li>
</ul>
neale's picture
Offline
Joined: 07/31/2009 - 15:14
A useful summary indeed! I

A useful summary indeed! I would add:

@output$status[[1]]

A value of −1 means that the optimizer found itself stuck in a location where the objective function could not be calculated, and could not find a way out. This most often happens if the starting values make the calculation impossible. Estimates from runs with output$status[[1]] equal to -1 can never be trusted, and the job must be re-run with different starting values, or a corrected model specification.

A value of 6 means that optimality conditions could not be reached, and the optimizer could find no way to improve the estimate. It often implies either a mistake in the model specification or starting values in an intractable range. The estimates resulting from this run are often NOT optimal estimates, and should not be treated as solutions, so this code is labeled (Mx status RED). The job should be re-run, either from the final solution, or from new starting values, or both. If multiple different starting values converge on the same solution (same parameter estimates and fit function) then confidence that the minimum has been found increases.