You are here

OpenMx Does Not Provide Correct Results for Example Code?

5 posts / 0 new
Last post
rabil's picture
Offline
Joined: 01/14/2010 - 16:47
OpenMx Does Not Provide Correct Results for Example Code?

I'm using the latest version of OpenMx on Ubuntu 16.04. I re-installed it a few minutes ago hoping it would fix what appears to be wrong. I'm also running OpenMx on Ubuntu 15.04 on another computer which appears to work correctly.

Here is the example code from mxTryHard:

library(OpenMx)
 
data(demoOneFactor)  # load the demoOneFactor dataframe
 
manifests <- names(demoOneFactor) # set the manifest to the 5 demo variables
latents   <- c("G")  # define 1 latent variable
model <- mxModel(model="One Factor", type="RAM",
    manifestVars = manifests,
    latentVars   = latents,
    mxPath(from=latents, to=manifests, labels=paste("b", 1:5, sep="")),
    mxPath(from=manifests, arrows=2, labels=paste("u", 1:5, sep="")),
    mxPath(from=latents  , arrows=2, free=FALSE, values=1.0),
    mxData(cov(demoOneFactor), type="cov", numObs=500)
)
model <- mxTryHard(model) # Run the model, returning the result into model
summary(model) # Show summary of the fitted model

Here are the results:

> model <- mxTryHard(model) # Run the model, returning the result into model
 
Begin fit attempt 1 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 2 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 3 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 4 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 5 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 6 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 7 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 8 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 9 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 10 of at maximum 11 tries
 
 Fit attempt generated errors
 
Begin fit attempt 11 of at maximum 11 tries
 
 Fit attempt generated errors
 
Retry limit reached
All fit attempts resulted in errors - check starting values or model specification

I tried this several times with the same results.

Now I just ran it again in the same session and I get what I think are the correct results.

The problem is, when I run my real model under 15.04 on the other computer, I get entirely reasonable results with confidence intervals. When I run it under 16.04 on this computer, all I get are error messages or if I ask for confidence intervals the code runs but never appears to finish.

The problem with 16.04 has been going on for months so I had switched to the other computer. I tried again by re-installing or installing the latest version on the 16.04 computer but OpenMx still seems to be broken under 16.04.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
Start values need to be better now

Hi,
It's not just ubuntu, same on all platforms. The issue is that the default start values are too far from the solution for some optimizers.

SLSQP solves the problem with no error, NPSOL solves with a code green, CSOLNP needs better start values.

I think the front page will likely be updated with a version starting the residuals at 1 and the paths from the latent variable at .2 or so.

A distinct issue is that code Red is much more common in newer versions of OpenMx. So even with good starting values, you may find code Reds.
Please let us know if the start values help.

PS: It's always helpful to append the results of mxVersion(): to queries like this.
PPS: umxRAM picks nice starting values for models. You can use this directly with umxValues()
PPPS: A nice new OpenMx function will be of help soon in cases like this m1 = mxAutoStart(m1)

rabil's picture
Offline
Joined: 01/14/2010 - 16:47
Thanks! I understand what you

Thanks! I understand what you are saying. I should have checked which optimizers were being used.

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
try again now

Yesterday we released v2.7.9. There are some bug fixes that might address this issue. Please try again now.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
All 3 optimisers same solution on Mac at least. one code red

Interesting, on Mac, without values, the correct solution is now reached by all 3 optimisers. CSOLNP code-reds but the solution is fine.

|name | Std.Estimate| Std.SE|CI                |
|:----|------------:|------:|:-----------------|
|b1   |         0.89|   0.01|0.89 [0.87, 0.91] |
|b2   |         0.93|   0.01|0.93 [0.92, 0.95] |
|b3   |         0.94|   0.01|0.94 [0.93, 0.95] |
|b4   |         0.96|   0.00|0.96 [0.95, 0.97] |
|b5   |         0.97|   0.00|0.97 [0.97, 0.98] |
|u1   |         0.21|   0.02|0.21 [0.17, 0.24] |
|u2   |         0.13|   0.01|0.13 [0.11, 0.15] |
|u3   |         0.11|   0.01|0.11 [0.09, 0.13] |
|u4   |         0.07|   0.01|0.07 [0.06, 0.09] |
|u5   |         0.05|   0.01|0.05 [0.04, 0.07] |
|     |         1.00|   0.00|1 [1, 1]          |
[1] "χ²(5) = 7.39, p = 0.193; CFI = 0.999; TLI = 0.999; RMSEA = 0.031"