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.
81 stars 46 forks source link

createMixtures() Error and incorrect file labeling with v 1.0 #165

Open joejonesphd opened 2 years ago

joejonesphd commented 2 years ago

Hello, I am working on running multiple mixture models. However, I am now getting an error (below) and the input files are being mislabeled when using the createMixtures() function. The below/attached code was used. Please note, that this code was originally created with v 0.8 and is being repurposed with v 1.0.

R Version 4.1.3

library(MplusAutomation) blind.dat <- read.csv('./Blinded Data.csv', check.names = F)

createMixtures(

run = 1L,

filename_stem = 'Test_v01', TITLE = 'Testing Models', rdata = blind.dat, usevariables = names(blind.dat), VARIABLE = ' IDVARIABLE = record; !CATEGORICAL = ; !AUXILIARY = ; ', classes = c(3:5),

classes = 3,

ANALYSIS = 'STSEED = 105; STARTS = 100 10; !STITERATIONS = 50;', model_overall = '!VAR_1 with VAR_2;', model_class_specific = c( "!VAR1 (Var1{C}); !VAR2 (Var2{C});

" ), OUTPUT = "ENTROPY MODINDICES TECH1 TECH2 TECH3 TECH10 TECH11 TECH14;", SAVEDATA = "FILE = {filenamestem}{C}saved.dat; SAVE = cprobabilities; TECH3 is {filenamestem}{C}tech3.dat;" )

ERROR Message: Error in check_mixtures(modelList) : mixtureSummaryTable requires a list of mixture models as its first argument. In addition: Warning message: In any(mixtures) : coercing argument of type 'list' to logical

LABELING ISSUE: For the labeling, I expect (given how the previous version printed files) to get 3 files labeled: "Test_v01_3_class.inp", "Test_v01_5_class.inp", and "Test_v01_5_class.inp"

Instead, I receive: "Test_v01_1_class.inp", "Test_v01_2_class.inp", and "Test_v01_3_class.inp" where the 1_class, 2_class, and 3_class files are correctly written for 3, 4, and 5 classes, respectively.

When looking at other issues posted, setting 'run = 1L' (commented out above) fixed the above error from showing, but it does not fix the labeling issue. In addition, adding 'run = 1l' also prints and runs the models. I would prefer to use runModels() instead of having createMixtures() initiate the analysis.

Please let me know if there is any additional information I can provide or if the attached zip folder does not work (data file attached separately as well). I greatly appreciate the help! Thanks, -Joe

Error issues.zip Blinded Data.csv

joejonesphd commented 2 years ago

Apologies for the formatting issues above. To clarify, 'run = 1L' and 'classes = 3' were commented out. Instead, 'classes = c(3:5) was used in place of the latter code commented out.