I'm trying to save model-predicted values in a growth curve model. The user guide explains how to save factor scores, but not how to do it for simpler growth models and I was unable to find a solution on the forums. Is this possible in the current version of Mplus?
Reviewers have requested we calculate the reliable change index and due to missing data, I've assumed that using predicted values would be the best route. Am I missing a better alternative?
Use the CPROBABILITIES option of the SAVEDATA command.
Helen Li posted on Saturday, September 20, 2014 - 8:24 am
Thank you, Professor! But if I simulated 100 sets of data, can I obtain class probabilities and most likely class membership for all these runs using some functions in MPlus? I hope my question makes sense. Thanks!
Helen Li posted on Saturday, September 20, 2014 - 4:19 pm
Dear Professor, as per my last question, I'm pasting the codes:
Title: New data sets to be saved data: FILE IS simlist.dat; !a file that contains a list of names of the generated data Type = Montecarlo; variable: names are y1-y4 x1 x2 c0; USEVARIABLES ARE y1-y4; classes = c(2); Auxiliary = x1 x2; analysis: Type = mixture; model: %overall% i s | y1@0y2@1y3@2y4@3; i* s*; i with s*; y1-y4*(ve); [c#1*0]; %c#1% [i*]; [s*]; %c#2% [i*]; [s*]; Output:Tech9; savedata: FILE IS simp.dat; save = cprobabilities;
The codes ran very well except that I got the following warnings and so I couldn't save the new data sets. May I know how can I get the new data sets?
"*** WARNING in SAVEDATA command The FILE option is not available for TYPE=MONTECARLO or TYPE=IMPUTATION. The FILE option will be ignored. *** WARNING in SAVEDATA command The SAVE option is not available for TYPE=MONTECARLO or TYPE=IMPUTATION. The SAVE option will be ignored. 2 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS"
I'm running into a problem saving cprobs with an ID variable. Could you please help me figure out the error?
The syntax I'm running is:
data: file is "C:\data\LSAC.csv"; variable: NAMES ARE ID Sex A1-A5 T1sweight; USEVARIABLES ARE ID A1-A5; IDVARIABLE IS ID; MISSING=all(-999) classes = c(4) cSex(2); knownclass = cSex (Sex=1 Sex=2); weight is T1sweight; analysis: TYPE = MIXTURE; model: %overall% i s q cu| A1@0A2@1A3@2A4@3A5@4; i@0; s@0; q@0; cu@0; OUTPUT: tech1 tech8 tech11 tech14; SAVEDATA: file is "C:\data\new.csv"; SAVE IS CPROB;
If I run it without "IDVARIABLE IS ID;" and remove ID from usevariables, it runs fine and saves the cprobs without an ID, but when I include the line it says: *** ERROR The number of observations is 0. Check your data and format statement. Data file: c:\data\LSAC.csv *** ERROR Invalid symbol in data file: "11103503" at record #: 1, field #: 1
Thuy, Thank you so much! That fixed the issue. I really appreciate your help! Happy Friday, Best, Camilla
Justin posted on Wednesday, August 02, 2017 - 7:43 pm
I am saving factor scores for use in a subsequent analysis as part of a large simulation study. I am finding that my saved data is not the same length as the original data.
The input data has N=10400 and the saved data is only of length 10000. Is 10000 the maximum possible length of SAVEDATA file? Is there a way around this default value? I tried RECORDLENGTH IS 10400 but it didn't seem to work.
Thank you, Justin
Justin posted on Wednesday, August 02, 2017 - 7:53 pm
Forgive my previous post, it appears that the output file states that the record length is 10000, but the actual saved data does include all 10400 records. Thanks!
I am running an LCA and that works perfectly. Only when i try to use a 'savedata' command it says "the number of observations is 0. Check your data and format statement'. Mplus also erases the data in the file i used. without the save data command it works perfectly. Any ideas?
Title: Latent Class Analysis. Data: File is "LCAvrm1.dat"; Variable: names =ID VLGTK VLGTL rvp pal ots swm; usevariables = VLGTK VLGTL rvp pal ots swm; classes = c(2); Missing is ots (999)VLGTK(999)VLGTL(999); Analysis: Type=mixture; Plot: type is plot3; series is VLGTK (1) VLGTL (2) rvp (3) swm (4) pal (5) ots (6); Savedata: File is "LCAvrm1.dat"; save is cprob; output: tech11 tech14;
I'm running an LPA. I'd like to save cprob as well as an additional variable (erTraM_1), which is not an indicator of the profiles. I need the additional variable in the data file for further analysis. Is this possible in Mplus?
Thanks for your help! Julia
VARIABLE: NAMES ARE id erTraM_1 sex sskM_1 soFaM_1 svVK4I_1 svCK3_12;
IDVARIABLE IS id;
USEVARIABLES ARE sex sskM_1 soFaM_1 svVK4I_1;
AUXILIARY = svCK3_12;
CLASSES = c(3); CATEGORICAL = sex svVK4I_1; Missing = ALL(-999);
You need to add MISSING = *; in the VARIABLE command. The saved data set uses * as missing. Be sure you are reading the data set according to the specification shown at the end of the output where the data were saved.