I'm having trouble figuring out the correct syntax for using TYPE = IMPUTATION with the mplusObject and mplusModeler functions. I've tried out various techniques, but no matter what I can't get the model to run as expected. Typically when I run mplusModeler it tells me that "formal argument "imputed" matched by multiple actual arguments". As background, I'm attempting to analyze PISA data which includes multiple plausible values for achievement outcomes. I'll leave the code short, but can provide more if useful.
Here's an example of how I'd really like to use the functions:
#save datafiles 1-10 with plausible values 1-10
#write text file to tell mplus where to find data
write.table(c(paste0("IMP",1:10,".dat")),"IMP input.txt",col.names=F,row.names = F,quote=F)
#create syntax and run it
model1<-mplusObject([model information], rdata = ????, imputed=T)
model1.results<-mplusModeler(model1, dataout="IMP input.txt", modelout="model 1.inp", run=1L, hashfilename=F,imputed=T)
Interestingly, mplusModeler writes the correct input file and can be run from mplus or R by calling the specific script, but I can't seem to get it to run without error using only the mplusModeler command.
In reading the help pages, the best that I've been able to come up with is that the rdata command in mplusObject needs to be a list, such as list("IMP1",...,"IMP10"), and these values should match dataframes held within the R session. So, rather than saving the dataframes as .dat files using prepareMplusData, I told the mplusObject() function that the rdata was my list of the dataframe objects.
Could someone help me out here? I must be missing something obvious about how imputed data works with mplusautomation, but I can't seem to figure it out from the help text.
Thanks in advance,