Tue, 07/02/2013 - 11:49

So I just started learning SEM this past year, teaching myself with some guidance from my advisor. I learned on AMOS, but I'm trying to teach myself OpenMX (just started last week).

Would anyone be willing to look over the model and script I have? Model I am trying to achieve (though I'm not sure it's entirely correct) is attached as pdf "Extraversion Latent Change Model". It is a latent change model, intercept and slope created from two latent models of extraversion (time 1 and time 2). It is not the best visual representation, but did what I could in ppt! I've also attached the script in pdf format, which I would greatly appreciate if someone would check over. It seems to mostly work except I get "Warning message:In sqrt(diag(expCov)) : NaNs produced" and fit indices are all NA.

Attachment | Size |
---|---|

Extraversion Latent change Model.pdf | 262.69 KB |

Extraversion Model script.pdf | 59.87 KB |

I've been editing my script to be more in line with this: http://openmx.psyc.virginia.edu/thread/815 but now I am getting an error: "Warning message:

In model 'Extraversion Model' NPSOL returned a non-zero status code 6. The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)"

I think perhaps my model is not fully identified, but I'm not sure what to do to fix that.

Could someone please look over my script and tell me what I'm doing wrong?

Also, in previous AMOS models I think we had correlated the errors of the manifest variables from time 1 to time 2, but it doesn't seem that I need to do so here... Does anyone know whether I should or not?

Any help is greatly appreciated!

I've checked over this model. I don't see an immediate problem for identification, but I see high potential for it being an issue. The reason for this is the hierarchical nature of the model: you have a factor model with a growth curve model on the factors. You could also have an identification problem because you're trying to do a linear growth model with two time points. A line always fits two points perfectly.

The Status Code RED could indicate non-identification, but it could also be any number of other possible issues. All I usually take from that error message is "Do not trust this solution. Something is weird about it.". Then I look further into what might have gone wrong. Do you get NAs in your standard errors? Or insane/implausible values for estimated parameters?

If you've set this model up in AMOS before and it worked, then I'd recommend looking into what AMOS did to identify the model, and use that to specify the OpenMx model. Alternatively, look into whatever source material you are using to create the model, and see how it's identified there.

I should note, the model in the script you attached in your second post differs from the model in the diagram from your original post in a couple important ways. First, the direction of the factor loading arrows is reversed. The way used in the script is much more common for factor models. Second, the manifest residual error variances are correlated in the diagram, but they are identical in the script.

That is the diagram has 12 manifest variances (6 variables measured at 2 times) that are correlated across time.

r1, r2, ..., r11, r12

r1 <-> r7

...

r6 <-> r12

The script has the same variances, but instead of correlated across time, they are identical.

r1, r2, ..., r11, r12

r1 = r7

...

r6 = r12

I've attached an edited version of your script. I have not substantively changed your model. I edited it to make use of the R paste() function to save you some tedious typing, made some tweaks to starting values, and added a few comments/questions.

Let us know if this helps, or if you have further questions!

Thanks so much for looking this over! I’m finding SEM and OpenMx to have a pretty steep learning curve.

1) I do have Na/NaNs (what is the difference there?) for standard errors.

2) Unfortunately I can’t compare this model with amos because it’s on a different computer far away... I've generally found AMOS to be inconvenient (I'm a mac user) so that's why I'm trying openmx.

3) The arrows are correct in the script version; I drew them the wrong way in ppt… Don’t know why because I have them draw correctly on the sheet of paper that was right in front of me when I did it.

4) I’m not sure what to do with the manifest variances. I think in my previous model (with different data) they were correlated, but I saw that someone else with a similar model had them constrained. Not sure which one is “better.”

5) Is there a specific reason for the starting values you chose? Or just that they are higher/lower values than before, so they are easier to estimate?

6) I wasn’t really sure what to do with the manifest means. I originally had them all free=FALSE, values=0, except in the other thread, Ryne suggested, “-fix the intercept/mean of ONE manifest variable to zero, and estimate the rest, also constraining to equality” but maybe I’m not doing that correctly either.

7) I know I was able to estimate the intercept and slope in AMOS, so hopefully that is not the problem! We need this information as well…

8) Even with this model I get the same error. ☹

Did a few variations of this, with means of intercept and slope fixed—same error. With variances correlated (as in first model) I get this: Error: The job for model 'Extraversion Model' exited abnormally with the error message: Expected covariance matrix is not positive-definite in data row 106 at major iteration 0 (minor iteration 1).

This is what we have forums for! We know that there is a steep learning curve to SEM and OpenMx, and the forums are here to help make it more shallow.

(1) Honestly, I'm not sure how an NA standard error occurs. An NaN (Not a Number) standard error occurs when the expected variance of a free parameter is negative. To get the standard error, we take the square root of the variance. And when you sqrt(-1.3) you get NaN. Problems with standard errors often co-occur with model identification issues.

(2) It's usually worth a shot.

(3) Good. I just wanted to make sure of the model you were trying to make.

(4) What you do with the manifest variances is up to you. Different structures imply different hypothesis about the nature of the error. If the factor loadings, manifest means, and manifest variances are constrained to be identical at both times then you are hypothesizing strict factorial invariance. If it's just the factor loadings and manifest means, that is strong factorial invariance. If it's just the factor loadings, that is weak (or metric) factrorial invariance. These are nested models. You can mxCompare(model1, model2) to test if they are different.

(5) Good starting values are hard to pick. You want them to be as close as possible to the true values, and we often have to guess. These are guesses that I've made in the past and have worked well for me. Really, I just don't like to give everything a starting value of zero or one. Those are often not good starting values.

(6) The code you have seems in line with Ryne's suggestions: http://openmx.psyc.virginia.edu/thread/815 But perhaps try switching the manifest variable with the fixed mean to be the same as the one with the fixed loading.

(7) Hopefully, that isn't the problem.

(8) The issue is probably not just the starting values that I changed. To re-iterate, I did NOT change your model; I only tweaked the starting values and took away some tedious typing.

Try the suggestion in (6) above, also attached. If it still does not work, try attaching the output from summary(ExtraT12ModelFit).

Could you tell me more about the mxFIMLobjective command? My problem may be with missing data. Coming from AMOS, I was thinking missing data would be automatically handled, which doesn't seem to be the case, but I'm having trouble understanding how I should go about including it in my script, especially creating the matrices.

Any RAM model that has raw data handles missing data automatically using the FIML objective function (later to be renamed the FIML fit function). The model scripts you've attached previously include mxData with type='raw', so the missing data is taken care of.

FIML handles missing data is by a filtering procedure described in this User's Guide page: http://openmx.psyc.virginia.edu/docs/openmx/latest/fiml_rowobjective.html

Please note again, however, that you do not have to do anything special to handle missing data with FIML in a path model in OpenMx. You give the model raw data, and OpenMx handles the rest.

OpenMx's behavior might be different from AMOS. AMOS might use FIML, imputation, EM, combinations of the above, or anything else. I simply do not know.

If your data does not contain any protected health information (or other sensitive material), you could include the data as an attachment, so someone on the Dev team can try running the model. Another option would be to use your data to generate fake data with similar properties and send us the fake data. This procedure is described here: http://openmx.psyc.virginia.edu/wiki/generating-simulated-data . Finally, you could send us the summary of the fitted model, which might give us some more information without having to send the data.