michaelhallquist / MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.
84 stars 46 forks source link

issue with how .inp is written when TYPE = IMPUTATION #88

Closed wepelham3 closed 4 years ago

wepelham3 commented 5 years ago

Bug seems to have been introduced between v0.7 and v0.7-3

When imputed = TRUE, the .dat file that contains a list of the individual imputed datasets is the modelout parameter with _implist appended.

But the .inp is written such that FILE equals the modelout parameter, without _implist appended.

So Mplus cannot find the datafiles.

library(mice)
library(MplusAutomation)

imp <- mice(nhanes)

imp <- complete(imp, action = "long")

implist <- split(imp, imp$.imp)

mod <- mplusObject(rdata = implist,
                   imputed = TRUE,
                   MODEL = "bmi on age;")

mplusModeler(mod,
             modelout = "model.inp",
             writeData = "always", run = 1)

Should produce an error in Mplus file like this:

*** ERROR in DATA command
  The file specified for the FILE option cannot be found.  Check that this
  file exists:  model.dat

I am using Mplus v7.4 if relevant.

JWiley commented 5 years ago

@wepelham3 Thanks will check into this and try to get a fix up soon.

JWiley commented 4 years ago

@wepelham3 I believe this is fixed now in commit 9209ea537369eb9e459323830ebad36d45669cf1