Message/Author 

Student 09 posted on Thursday, April 30, 2009  8:54 am



Hi I wonder whether there is any possibility to save variables which are not part of the model with the savedata command. I need to save both fscores and an Identifiervariable, which is not part of the model, and obviously cannot be saved together with the information on the fscores? thanks 


See the FSCORES option of the SAVEDATA command and the IDVARIABLE option of the VARIABLE command. You can save other variables using the AUXILIARY option of the VARIABLE command. 


would the SAVE FSCORES option save factor scores that are free from measurement error if you are specifying a latent variable with 5 predictors? 


Also, I am confused about how I am receiving a factor score for those participants who have no data. Thanks! 


The default in Mplus is to estimate the model using all available information and missing data estimation. Therefore, all observations receive a factor score. For listwise deletion, add LISTWISE=ON; to the DATA command. Factor scores are not the same as the factors in a model. How close they are to each other can be seen in the factor determinacy score. See the FSDETERMINACY option of the OUTPUT command. 


Thank you! One follow up question. If I have 5 measures and am creating a latent variable and then using that latent variable in subsequent analyses with other latent variables would the model use the same factor scores as I would receive in the fscores output? Is that what you meant by the factor scores are not the same as the factors in the model? For example, if I created a mean composite of the 5 measures would that differ the fscores output? 


To clarify further: I am doing a 4 latent variable cross lagged analysis in mplus but first doing CFA analyses on each of the 4 variables. Would the fscores data be the same as what is being used in this 4 latent variable cross lagged analysis? I would like to extract the same data without measurement error. Is that possible? Thank you again! 


I do not understand your question. However, I would only use factor scores if it was unavoidable. 


Sorry if that was unclear. I am doing a basic 1Factor CFA using 5 measures. When using the SAVE Fscores option, I am wondering whether the factor scores that are saved are free from measurement error. Thank you! 


Factor scores can be seen as free of measurement error, but are not free of estimation error. Estimated factor scores do not behave as true factors (give different variances and relations to other variables) unless you have many good indicators. See for instance Skrondal, A. and Laake, P. (2001). Regression among factor scores. Psychometrika 66, 563575. 


When factor scores are saved, are they placed in the rightmost columns in the DAT file? (This will affect the VARIABLE NAMES line in the program where I call in the saved data file.) 

Jon Heron posted on Wednesday, February 15, 2012  8:47 am



Hi Lisa, it should tell you at the end of your .out file, e.g. here it's the last 8 vars SAVEDATA INFORMATION Order and format of variables TOT_T1 F10.3 TOT_T2 F10.3 TOT_T3 F10.3 TOT_T4 F10.3 TOT_T5 F10.3 AGE_T1 F10.3 AGE_T2 F10.3 AGE_T3 F10.3 AGE_T4 F10.3 AGE_T5 F10.3 INTCPT1 F10.3 INTCPT1_SE F10.3 SLOPE1 F10.3 SLOPE1_SE F10.3 INTCPT2 F10.3 INTCPT2_SE F10.3 SLOPE2 F10.3 SLOPE2_SE F10.3 


Thanks, Jonthis is very helpful! I see in the Mplus manual how to merge files using an ID variablebut it is problematic that the saved factor score file does not have an ID in it. How then do I merge these saved factor scores back into my main data set? Thank you so much. 

Jon Heron posted on Wednesday, February 15, 2012  9:18 am



You can push the ID through to the final file within your variable section using idvariable = ID; the data I use had more than one ID and this isn't permitted with this command. If you're like me then you'll need to push other variables through using "auxiliary" so I do idvariable = ID1; auxiliary = ID2; Don't put them in your usevariable list though  the ID variable rarely fits the model well!! 


ExactlyI didn't want to put ID in the USEVARIABLE list because it would mess up the fit of my factor models! Thanks so much, Jon, for your expertise on this. 


Hi, I've just spent hours trying to save my factor scores through the MFILE command of the SAVEDATA function. I can save the factor scores no problem but I can't seem to get the factor scores to be merged back into the original dataset. Even trying to take them into SPSS was a problem with the factor scores being saved over three columns/variables. With MFILE, should I be nominating the original dataset that I want to merge the factor scores into? Regards, Joanne 


You should be using the SAVE option if you want the factor scores in the original data set: SAVE = FSCORES; 


Hi Linda, can you tell me what is wrong in my Mplus script below, such that I get the error message at the bottom of this section of text? I was relying on p. 404 of the current Mplus manual as an example. This script begins at the ANALYSIS line of my program, to save space. ANALYSIS: TYPE = BASIC; SAVEDATA: MFILE = FACTORSCORES.DAT; MNAMES ARE H4MH3R H4MH4R H4MH5R H4MH6R H4PE37R H4PE38R H4PE39R H4PE40R H4PE41R AID GENERAL CONCRETE; MFORMAT IS 9F10.3 I9 2F10.3; MSELECT ARE GENERAL CONCRETE; MMISSING = H4MH3R H4MH4R H4MH5R H4MH6R H4PE37R H4PE38R H4PE39R H4PE40R H4PE41R AID GENERAL CONCRETE (. *); FILE IS MERGED.sav; FORMAT IS FREE; MISSFLAG = .; *** ERROR in SAVEDATA command Unknown option: MFILE 


Please send the output and your license number to support@statmodel.com. 


Hi Linda, I took the advice of you and Jon Heron above, and saved the factor scores using the SAVE=FSCORES command, and selected other variables that I wanted in the saved data set using the AUXILIARY option. But when I work with the newly created data set, factorscores_022312.dat, I get the message. Why would this be? *** ERROR The number of observations is 0. Check your data and format statement. Data file: D:\AH\locker\factorscores_022312.dat *** ERROR Nonmissing blank found in data file at record #1, field #: 18 


Open the data file and look at record 1 filed 18. 


Hi Linda, can I change the default missing data flag when saving FSCORES from * to another value such as 999 or 999? I got an error message when I tried to change the default missing data flag in this script. SAVEDATA: FILE IS FACTORSCORES_022812.DAT; SAVE = FSCORES; MISSFLAG = 999; 


Please send the output and your license number to support@statmodel.com. 


Hi Linda, thanks for all of your help. What does it mean that Mplus saved two versions of my latent variables in the DAT file with the fscores: GENERAL F10.3 GENERAL_SE F10.3 CONCRETE F10.3 CONCRETE_SE F10.3 Does the "_SE" refer to a standard error? 


Yes. 


Hi Linda, I noticed that when I use SAVE FSCORES for a categorical factor analysis, SEs for the saved factor scores are missing from the list of variables in the DAT file that is created. Is that true: There are no saved SEs for fscores from a categorical CFA? Thanks. 


Mplus 6.12 does not have that, but if you use ML you can get that information via the information curve that you get in the PLOT command. One divided by the square root of the information value is the SE for the factor score at that factor value. 

Franziska posted on Tuesday, May 06, 2014  9:02 am



Dear Drs. Muthén, I do have the same problem that has been posted by Joanne Bradbury on Thursday, February 16, 2012  3:35 pm I have also spent hours trying to save my factor scores back into the original dataset through "just" the SAVE = FSCORES command. However, the output then tells me that this command is ignored as there is no datafile specified. What am I doing wrong? Thanks for answering! Franziska 


You need to use the FILE option of the SAVEDATA command with SAVE=FSCORES. See the SAVEDATA command in the user's guide. 

Franziska posted on Thursday, May 08, 2014  9:16 am



Hi Linda, this is what I have done: Title:ESEM Germany 05  Model 2: Invariance 8 factors, factorscores Data: File is "C:\Users\wma117\Desktop\GERMANY_complete5.dat"; LISTWISE = ON; Variable:Names are id br y co ca loc know es rel a1 a2 b1.....in1; [had do delete it due to message size] CATEGORICAL ARE a1in1; USEVARIABLES = a1in1; Missing are all (66); GROUPING IS loc (0=loc 1=glob); MODEL: f1f8 BY a1in1(*1); ANALYSIS: PARAMETERIZATION = THETA; ITERATIONS = 10000; SAVEDATA: FILE IS GERMANY_complete5.dat; SAVE = FSCORES; OUTPUT: Standardized (STDYX)cinterval; This was to try to save the factor scores into the original dataset to work with this afterwards. However, now the output says: *** ERROR The number of observations is 0. Check your data and format statement. The dataset is fine. If I save the factorscores in a new dataset, everything runs smoothly. I would really appreciate a helpful comment. Thanks! Franziska 


You can't use the same data set name in the FILE option in DATA and the FILE option in SAVEDATA. 

Franziska posted on Monday, May 12, 2014  12:08 am



Hi Linda, thanks for the clarification! So, as I see it, it is not possible to save factor scores "back" to the original dataset, right? Thanks so much again for your support! Franziska 


Correct. 


Hi Linda 1. Could please be kind and post the solution to Yandell's MISSFLAG error above (post Feb 28 2012)? 2. How I can save all the records from the input dataset when I save the Fscores, even though these are considered missing on all values (listwise is off)? 3. Why doesn't the savedata FORMAT IS function work; neither with spaces or commas between? Tried both Demo (mine) and full (campus) version of Mplus 7.2 [...] Savedata: File = Inquiry2.dat; Save = Fscores; Missflag = 9; Format = 4F1.0 F5.3 2F8.0 F5.3 2F8.0; ! Format = 4F1.0, F5.3, 2F8.0, F5.3, 2F8.0; *** ERROR in SAVEDATA command Unknown option: Missflag9 Order and format of variables I1 4F1.0 I2 4F1.0 I3 4F1.0 I4 4F1.0 SCIWGT 4F1.0 IDTEACH2 4F1.0 IDSTUD2 4F1.0 INQUIRY 4F1.0 STRATUM2 I8 TEACHID I8 Save file format 84F1.0 2I8 


The FORMAT statement takes only one argument after the equal. Regarding MISSFLAG, please send the output and your license number to support@statmodel.com. 


Can negative numbers be used as missflag in the savedata command? In my analysis I received the following error message: *** ERROR in SAVEDATA command Unknown option: missflag99 Thanks Johannes 


Try MISSFLAG = 99; 


That was the input that I tried and that gave me the error message. SAVEDATA: FILE IS output_pred.dat; FORMAT IS FREE; SAVE IS FSCORES; missflag = 99; *** ERROR in SAVEDATA command Unknown option: missflag99 


Please send the output and your license number to support@statmodel.com. 

M.F. posted on Tuesday, June 07, 2016  11:41 pm



Hello, I saved the factor scores for my seven items. Five of them are categorical. When I compare the new file with the original data, I found that the categorical variables are changed and have new scores. The order is the same, I checked the Id. I can't find why they are changed. Can you pleas help me. Thanks. 


See the CATEGORICAL option in the user's guide for an explanation of how the categorical items are recoded. 


Linda, Could you clarify what information is saved by the fscores subcommand? My input basically looks like this: model: Factor1 by OV1 OV2 OV3 OV4 OV5; Factor2 by OV6 OV7 OV8; output: sampstat stdyx; savedata: file is CFA_fs.dat; save is fscores; and I get 4 new variables. The first and third variables appear to be the factor scores (for Factor1 and Factor2 respectively I assume). Are the second and fourth variables SEs? Thanks in advance for your help. Dan 


Yes, "Factor1_SE" refers to the Standard error of the factor score. 

Back to top 