You are here

Missing data - OpenMx vs Mplus

8 posts / 0 new
Last post
ana.martinovici's picture
Offline
Joined: 12/08/2014 - 08:49
Missing data - OpenMx vs Mplus

Hi,

The data set i use has 214 individuals for which I have different number of observations - varies between 21 and 30.
I try to estimate a model of nonlinear growth - I specify this using constraints on the factor loadings. When i estimate this model in Mplus I use dummy variables that load on the observed for the missing data. There are 9 Dummy variables that are =1 if I observe data for that individual at that time point, =0 otherwise. For example, if D22=1 for ID1, then individual 1 has observed data at time point 22. The Mplus model is estimated normally, it looks ok. However, when i do the same in OpenMx, it doesn't work.
In OpenMx I have tried two approaches:
1. use the same model as in Mplus with dummies that load on the observed - Path20
2. use the same model as in Mplus but exclude the dummies. All other Paths and constraints are kept. I would expect this approach to work, since i use raw data and therefore FIML.
Neither of these two is successful.

I have the following errors/warnings for the two approaches:
1. Error: The job for model 'Mplus copy' exited abnormally with the error message: MxComputeGradientDescent: fitfunction Mplus copy.fitfunction is not finite (Expected covariance matrix for continuous variables is not positive-definite in data row 164)
In addition: Warning message:
In model 'Mplus copy' Optimizer returned a non-zero status code 10. Starting values are not feasible. Consider mxTryHard()
i have used mxTryHard, but then I get the following error:
Error : The job for model 'Mplus copy' exited abnormally with the error message: MxComputeGradientDescent: fitfunction Mplus copy.fitfunction is not finite (Expected covariance matrix for continuous variables is not positive-definite in data row 164)
Error in omxSetParameters(model, labels = names(params), values = params * :
'labels' argument must not contain duplicate values

  1. Warning message:
    In model 'Mplus copy' Optimizer 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)
    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)

Here are some questions I hope you can help me with:
1. In the raw data set I have NA for missing values. Is there anything else i need to do such that the model is estimated with FIML?
2. How come the model that exactly replicated the Mplus code is not giving the same output?
3. What is the error on "'labels' argument must not contain duplicate values" about? I don't see what is wrong with the labels I use.

Note: I have also estimated the same model on the first nine time points, so I have no missing data. All is ok and I get the same results in Mplus and OpenMx. Adding missing data messes it up.

Thank you,

Ana

mhunter's picture
Offline
Joined: 07/31/2009 - 15:26
It's not the same model

Hi Ana,

To answer your questions directly, see below.

  1. Any model with raw data and an ML fit function will use FIML. There's nothing else you need to do to turn it on.

  2. The "'labels' argument must not contain duplicate values" problem was a bug. It's fixed in the latest SVN revision. http://openmx.psyc.virginia.edu/thread/3939

  3. I've looked over the script you attached for the dummy variable model that intends to replicate the Mplus model. It's not the same model. The first thing you should address is the starting values. For several variance terms you give starting values of zero (Path1, Path8, Path11, and Path12). Sometimes this will still work, but give us a better shot and use any non-zero starting value for a variance. Second, Mplus allows exogenous manifest variables with zero variance (covariates). OpenMx does not, so the D22-D30 variables have zero variance and this makes the expected covariance matrix non-positive definite. I made some modifications to your thirtyfixationswithdummy.R script and attached the result. It gives estimates essentially identical to Mplus.

Cheers,
Mike Hunter

ana.martinovici's picture
Offline
Joined: 12/08/2014 - 08:49
Model without dummies

Hi Mike,

Thank you for your help. The code looks better now.

If OpenMx uses FIML, then how come the model without the dummies for missing data, but with NA doesn't converge? I have the following error: "Error : The job for model 'Mplus copy' exited abnormally with the error message: MxComputeGradientDescent: fitfunction Mplus copy.fitfunction is not finite (Expected covariance matrix for continuous variables is not positive-definite in data row 193)"

For each individual there is a different total number of observations. For example, if ID1 has 12 observations, then F1-12 have a value and then starting with F13 there is only NA.

Best,

Ana

mhunter's picture
Offline
Joined: 07/31/2009 - 15:26
Works for me

Hi Ana,

Why are the variances of lxs and dxs fixed to 0.5? When I fixed them back at zero (like the dummy version of the model) and added lower bounds to the estimated variances, everything seemed to work well. I still get a status code 6, but given the model, data, and fit I'm not terribly surprised or upset by that. See attached image of summary.

RobK's picture
Offline
Joined: 04/19/2011 - 21:00
Different parametrization?

You're trying to do a latent-growth analysis where the growth curve is a second-degree function of time, right? If I correctly understand what you're trying to do in your script, then you might want to try a different way of parameterizing your model. I've attached a script that sets up the latent-growth analysis in terms of the common-factor model (and doesn't use RAM). It also has built-in safeguards against a non-positive-definite expected covariance matrix. It reaches a solution without throwing any warnings.

Edit: it might not be a bad idea to allow each timepoint to have its own unique variance. Append the following to the script I attached:

quadmodel2 <- quadfit
diag(quadmodel2$U$labels) <- paste("u",1:30,sep="")
quadfit2 <- mxTryHard(quadmodel2)
RobK's picture
Offline
Joined: 04/19/2011 - 21:00
Build from source?

Ana, is the "'labels' argument must not contain duplicate values" bug going to be problematic for you? If so, do you know how to build OpenMx from the source repository, so you can use a recent revision in which the bug is repaired?

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
just use a work-around

It is super simple to work around the "'labels' argument must not contain duplicate values" bug. Just filter the vector by !duplicated. It's not worth building from the source repository just for this small bug fix.

ana.martinovici's picture
Offline
Joined: 12/08/2014 - 08:49
Can you explain how to do this, please?

I don't know how to add this filter.

Thank you,

Ana

Log in or register to post comments