# How to implement FIML estimation in OpenMx?

2 posts / 0 new
Offline
Joined: 03/14/2019 - 09:44
How to implement FIML estimation in OpenMx?

Hello,
I am running this code to conduct LGCM prior to GMM.
I was wondering if there is a way of implementing FIML instead of ML in my code.

This is because my data has a lot of missingness by design (longitudinal data) and is not normally distributed.

Many thanks!!!

require(OpenMx)

?MxFitFunction
fitFunction <- mxFitFunctionML(rowDiagnostics=TRUE)
mxOption(NULL,"Default optimizer","SLSQP") ### to avoid msg error: https://openmx.ssri.psu.edu/node/4238

linear_growth_model <- mxModel('Linear Growth, Path Specification', fitFunction,
type='RAM', mxData(observed=dfwide_OpenMx, type='raw'),
manifestVars=c('health_2','health_3','health_4','health_5','health_6','health_7','health_8','health_9'),
latentVars=c('eta_1','eta_2'),
# residual variance paths
mxPath(from=c('health_2','health_3','health_4','health_5','health_6','health_7','health_8','health_9'),
arrows=2, free=TRUE, values=1, labels='th'),
# latent variable variances and covariance paths
mxPath(from=c('eta_1','eta_2'), arrows=2, connect='unique.pairs',
free=TRUE, values=c(1,0.5,1), labels=c('psi_11','psi_21','psi_22')),
mxPath(from='eta_1', to=c('health_2','health_3','health_4','health_5','health_6','health_7','health_8','health_9'),
arrows=1, free=FALSE, values=1),
mxPath(from='eta_2', to=c('health_2','health_3','health_4','health_5','health_6','health_7','health_8','health_9'),
arrows=1, free=FALSE, values=c(0, 1, 2, 3, 4, 5, 6, 7)),
# means and intercepts
mxPath(from='one', to=c('eta_1','eta_2'),
arrows=1, free=TRUE, values=c(1,1), labels=c( 'alpha_1',
'alpha_2'))
) # close model

linear_growth_model = mxModel(linear_growth_model, mxCI(c('psi_11','psi_21','psi_22', "th", "alpha_1", "alpha_2"))) # list the things you want CIs for.
linear_growth_model = mxRun(linear_growth_model, intervals= T)
summary(linear_growth_model, refModels=mxRefModels(linear_growth_model, run = TRUE))

model_linear <- mxTryHard(linear_growth_model) # Run the model, returning the result into model
summary(model_linear)

Offline
Joined: 07/31/2009 - 14:25
mxFitFunctionML is FIML with raw, and ML with cov data

tldr: mxFitFunctionML will just automatically do FIML with raw data (and complain if you don't model the means of that raw data).

Longer answer: "Missing data", "missingness by design", and "non-normally distributed data" are three very different things.

Missingness is a complex but crucial factor. wikipedia has some coverage of the important concepts. If your data have missingness which is associated with predictors or outcomes (men less likely to respond, more likely to be diagnosed with ADHD, for instance), then modeling is precarious.

If your data are continuous but non-normal you probably want to transform them to normal. For instance, reaction time data might be better analysed with each point transformed as 1/mean(log(1/RT)), where RT is the individual reaction times for a subject.

Alternatively, you might want to use ?mxFitFunctionWLS

If you'd be interested in OpenMx supporting Tobit/censored analyses, that's on the medium-term radar for OpenMx.