MplusAutomation icon indicating copy to clipboard operation
MplusAutomation copied to clipboard

Issue Running Model with Imputed Data Using mplusModeler

Open linem7 opened this issue 1 year ago • 0 comments

Hi,

I've encountered an issue when trying to run a model with imputed data using the mplusModeler function. The script doesn't execute the model, and I have to manually click the run button within Mplus. This suggests that while the syntax created by mplusObject and mplusModeler seems correct, it isn't being applied by the Mplus engine.

Below is the R and Mplus syntax I used:

model_mistep2 <- mplusObject(
    TITLE = "model with imputed data;",
    imputed = TRUE,
    VARIABLE = "names are rt sm exe;",
    MODEL = "
    exe on rt sm(c b);
    sm on rt(a);",
    MODELCONSTRAINT = "
    new(med);
    med = a * b;",
    OUTPUT = "stand cint tech4;"
)

mplusModeler(
  model_mistep2,
  # Data sets are in 'mi_data', within 'Mplus_Model', at the same level as the .inp file.
  dataout = str_glue("./mi_dataset/p1_list.txt"),
  modelout = str_glue("./Mplus_Model/mi_step2.inp"),
  run = 1L,
  hashfilename = FALSE
  )

The syntax in the .inp file is:

TITLE:
model with imputed data;
DATA:
FILE = "./mi_dataset/p1_list.txt";
TYPE = IMPUTATION;

VARIABLE:
names are rt sm exe;
MODEL:
    exe on rt sm(c b);
    sm on rt(a);
MODEL CONSTRAINT:
    new(med);
    med = a * b;
OUTPUT:
stand cint tech4;

Could you let me know if there’s anything wrong with the syntax, or if this might be a bug in MplusAutomation?

Best regards, Lin

linem7 avatar Aug 15 '24 02:08 linem7