Writing to savedata file PreviousNext
Mplus Discussion > Latent Variable Mixture Modeling >
Message/Author
 Jeanne Geiger Brown posted on Monday, June 04, 2007 - 3:02 pm
Hi,
I've finished an analysis and want to write the Cprob and Cluster variables to an output file including the subject ID number. I was able to get the CProb and Cluster variables in a .dat file but these were not linked to the subj ID. Can you correct my syntax to include the subject ID number (residno)- only applicable parts of syntax pasted below. Thanks.

VARIABLE:
NAMES ARE residno psy_del agit_agg refus_re call_out anxiety
depress withdr_l sleep_do delir_LO;
USEVARIABLES ARE psy_del - sleep_do ;
CATEGORICAL ARE psy_del-sleep_do ;
CLASSES = cluster(3);


SAVEDATA: FILE IS "threeclass.dat";
SAVE IS CPROB;
 Linda K. Muthen posted on Monday, June 04, 2007 - 3:54 pm
Use the IDVARIABLE option of the VARIABLE command to include an id variable in the saved data.
 Scott C. Roesch posted on Thursday, June 07, 2007 - 8:00 am
Hi there:

I am running an LPA using the code below. The MPlus output file states that it has processed and assigned 1198 cases to the classes. However, when I pull the .sav file into SPSS (the file created with the SAVEDATA command) only 874 have numeric values for class membership. The 324 other cases are assigned missing values. There appears to be a disconnect between what the MPlus output file is reporting and the file that the SAVEDATA command generated. Any help would be greatly appreciated.

TITLE: lpa-2 classes

DATA: FILE C:\SCOTT\Grants\LONGSCAN\LPA\MALTX_053107.dat;
FORMAT IS FREE;

VARIABLE: NAMES ARE CASEID
MSPA06 MSPA68 MSPA810 MSPA1012
MSSA06 MSSA68 MSSA810 MSSA1012
MSFP06 MSFP68 MSFP810 MSFP1012
MSLS06 MSLS68 MSLS810 MSLS1012
MSEM06 MSEM68 MSEM810 MSEM1012
PHYAtot SARAtot PSMAtot neglect;

USEVARIABLES ARE MSEM06 MSEM68 MSEM810 MSEM1012 PSMAtot;

MISSING ALL (-999);

IDVARIABLE IS CASEID;

CLASSES = C(2);

ANALYSIS: TYPE = MIXTURE MISSING;
STARTS = 50 5;

OUTPUT: TECH11;

SAVEDATA: FILE IS C:\SCOTT\Grants\LONGSCAN\LPA\2class_emotional.SAV;
SAVE IS CPROB;
 Linda K. Muthen posted on Thursday, June 07, 2007 - 8:17 am
This is an Mplus support question. Please send your input, data, output, saved data, and license number to support@statmodel.com.
 Feifei Li posted on Wednesday, September 17, 2008 - 2:24 pm
Hi,there

I have a question regarding Lo-Mendell-Rubin (LMR) test. When I save result by using "savedata" options, I can only get BIC, AIC, Entropy such regular goodness of fit statistics for mixture model in a compact form of data. How can I also include LMR in this small .dat file?

Thanks,
Mary
 Linda K. Muthen posted on Wednesday, September 17, 2008 - 3:28 pm
In Version 5.1 these values are saved.
 Michelle posted on Thursday, August 06, 2009 - 8:42 am
Hi - I am having a similar issue to Scott who posted 6-7-08. I am using MPlus for an LCGA-survival analysis and would like to import the cprob data into STATA for further analysis. Two problems seem to arise: 1) there is a disconnect between what the MPlus output reports as the class assignment and what shows up in the ASCI file. For instance, MPlus reports in the output file that there are approximately 900, 400, and 2100 people in each of three classes based on the most likely class assignment; however, when reading the data into STATA, I ask for a count of the various classes, and it reports a nearly even ~1100, ~1000, ~1300 split of the different classes. I can't figure out this discrepancy. Secondly, even though I have specified the ID Variable in the VARIABLE portion of the command, it still seems to be reporting it incorrectly in the data file. I have ~3600 cases in the dataset, and at case 1100, everyone from 1100 to 1199 gets 1100 as their ID variable; then the next 100 get 1200, and so on. I have been able to determine that the data are still in case id order (based on the other variables in the dataset) and so was able to just add an extra field that replicates the case id, but I am curious if there is a different solution to this.
 Linda K. Muthen posted on Thursday, August 06, 2009 - 11:05 am
Please send the files and your license number to support@statmodel.com.
 Christine Critchley posted on Wednesday, April 13, 2011 - 5:31 pm
Hello I am running a LCA with 3 clusters and nominal indicators, and want to save the cprob data. When I run the analysis the output says the data file has been saved, but the file is nowhere to be found. I have tried this for a number of cluster solutions and the same problem exists. I have done LCA before and the data has saved before. I am wondering if I am doing anything wrong. I am using:

SAVEDATA:
FILE IS "class3.dat";
SAVE=CPROB;

Thanks!
 Linda K. Muthen posted on Thursday, April 14, 2011 - 8:48 am
If the data are not saved, there should be a message in the output. Or perhaps you are trying to write to a directory where you don't have write privileges. If you cannot figure this out, send your input, data, and license number to support@statmodel.com.
 Nate Breznau posted on Monday, May 11, 2015 - 1:25 pm
Dear Dr's. Muthen,

I am sorry if I missed the simple answer to this somewhere. In the Plot commands I can plot observed or estimated variables. What I really want to do is SAVE the estimated variables. I.e. predicted values for each individual in the data. Is there an easy way to do this with the SAVEDATA command or do I have to program hand equations to estimate predicted values?

Many thanks!
 Bengt O. Muthen posted on Monday, May 11, 2015 - 6:20 pm
No easy way yet in Mplus.
 AT Jothees posted on Sunday, March 19, 2017 - 12:25 am
Hi,

I have no problem in using the save command, but I have difficulties in understanding the variables in the saved data files.

In the mplus OUTPUT,I see list variables and their names specified. But when I open the saved file, I see several additional variables. I don't understand why there are additional variables in the saved file other than the list mentioned in the output file.

I just wanted to save the factor scores, indicator variables and the ID variable in the new file with no additional variables. Is this possible?

Many thanks in advance
 AT Jothees posted on Monday, March 20, 2017 - 1:54 am
Hi,

Thank you.

I managed to figure out the solution.

Regards,

J
 Sunil Sahadev posted on Wednesday, December 20, 2017 - 6:14 am
Hi
I am running an LCA with 431 observations. However the Mplus output says there are only 407 observations and this is how it is in the saved data file. I can't figure out why the remaining 24 observations have not been processed. I don't have so many missing values. Also when I open the saved file (in txt) I can see that none of the observations have values 4 or 5 while in the original data (ie. with 431 observations), there are several observations with 4 and 5 values. The codes I have used are given below:

Categorical are A82-A88;
Usevariables are A82-A88;
Missing are all (-9);
Classes = c(3);

Analysis:
type = mixture;

Output: Tech11; Tech14;
Savedata: File is LCA.txt;
Save is cprob;
format is free;
 Bengt O. Muthen posted on Wednesday, December 20, 2017 - 12:22 pm
The output should tell you which 24 observations are not included (e.g. because all Usev variables have missingness for these 24). If this doesn't help, send your output and data to Support along with your license number.
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: