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

Error in if (all(sapply(modelList, function(x) { : missing value where TRUE/FALSE needed In addition: Warning message: In all(sapply(modelList, function(x) { : coercing argument of type 'list' to logical #176

Open joshua-zh opened 1 year ago

joshua-zh commented 1 year ago

Hi, would you like to help me?

library(poLCA) data(cheating)

cheating <- cheating %>% clean_names()

df_cheat <- cheating %>% # dplyr::select(1:4) %>% # dplyr::mutate_all(funs(.-1)) #

Run a quick LCA using createMixtures

createMixtures(classes = 1:4, filename_stem = "cheat",
rdata = df_cheat,
ANALYSIS = "processors = 10; starts 500 100;",
VARIABLE = "CATEGORICAL = lieexam-copyexam;",
PLOT = "type = plot3; series = lieexam-copyexam(*);")

files <- data.frame(names = list.files(path = here(), full.names = FALSE))

f_cheat <- files %>% dplyr::filter(., grepl('cheat', names))

for (i in 1:length(f_cheat)) { file.move(glue(here("{f_cheat[, i]}")), here("enum_ch")) }

runModels(here("enum_ch"), filefilter = "cheat")

View model fit statistics with mixtureSummaryTable()

output_cheat <- readModels(here("enum_ch"), filefilter = "cheat", quiet = TRUE)

No PROPORTION OF DATA PRESENT sections found within COVARIANCE COVERAGE OF DATA output. No PROPORTION OF DATA PRESENT sections found within COVARIANCE COVERAGE OF DATA output. No PROPORTION OF DATA PRESENT sections found within COVARIANCE COVERAGE OF DATA output. No PROPORTION OF DATA PRESENT sections found within COVARIANCE COVERAGE OF DATA output.

gt(mixtureSummaryTable(output_cheat)) %>% # tab_header( # title = "Fit Indices") %>% # tab_options( # table.width = pct(80)) %>% # tab_footnote( # footnote = "Undergraduate Cheating Behavior", # location = cells_title())

Error in if (all(sapply(modelList, function(x) { : missing value where TRUE/FALSE needed In addition: Warning message: In all(sapply(modelList, function(x) { : coercing argument of type 'list' to logical