Save fscores PreviousNext
Mplus Discussion > Categorical Data Modeling >
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 Identifier-variable, which is not part of the model, and obviously cannot be saved together with the information on the fscores?

thanks
 Linda K. Muthen posted on Thursday, April 30, 2009 - 11:40 am
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.
 Marissa Ericson posted on Thursday, June 23, 2011 - 9:27 am
would the SAVE FSCORES option save factor scores that are free from measurement error if you are specifying a latent variable with 5 predictors?
 Marissa Ericson posted on Thursday, June 23, 2011 - 10:41 am
Also, I am confused about how I am receiving a factor score for those participants who have no data. Thanks!
 Linda K. Muthen posted on Thursday, June 23, 2011 - 11:39 am
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.
 Marissa Ericson posted on Thursday, June 23, 2011 - 11:46 am
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?
 Marissa Ericson posted on Thursday, June 23, 2011 - 11:49 am
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!
 Linda K. Muthen posted on Friday, June 24, 2011 - 9:25 am
I do not understand your question. However, I would only use factor scores if it was unavoidable.
 Marissa Ericson posted on Friday, June 24, 2011 - 9:58 am
Sorry if that was unclear. I am doing a basic 1-Factor 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!
 Bengt O. Muthen posted on Friday, June 24, 2011 - 10:27 am
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, 563-575.
 Lisa M. Yarnell posted on Wednesday, February 15, 2012 - 8:43 am
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
 Lisa M. Yarnell posted on Wednesday, February 15, 2012 - 9:06 am
Thanks, Jon--this is very helpful! I see in the Mplus manual how to merge files using an ID variable--but 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!!
 Lisa M. Yarnell posted on Wednesday, February 15, 2012 - 9:22 am
Exactly--I 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.
 Joanne Bradbury posted on Thursday, February 16, 2012 - 3:35 pm
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
 Linda K. Muthen posted on Friday, February 17, 2012 - 2:01 pm
You should be using the SAVE option if you want the factor scores in the original data set:

SAVE = FSCORES;
 Lisa M. Yarnell posted on Wednesday, February 22, 2012 - 11:36 pm
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
 Linda K. Muthen posted on Thursday, February 23, 2012 - 6:52 am
Please send the output and your license number to support@statmodel.com.
 Lisa M. Yarnell posted on Thursday, February 23, 2012 - 10:10 am
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
Non-missing blank found in data file at record #1, field #: 18
 Linda K. Muthen posted on Thursday, February 23, 2012 - 11:16 am
Open the data file and look at record 1 filed 18.
 Lisa M. Yarnell posted on Tuesday, February 28, 2012 - 9:50 am
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;
 Linda K. Muthen posted on Tuesday, February 28, 2012 - 10:28 am
Please send the output and your license number to support@statmodel.com.
 Lisa M. Yarnell posted on Monday, March 05, 2012 - 12:32 pm
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?
 Linda K. Muthen posted on Monday, March 05, 2012 - 12:40 pm
Yes.
 Lisa M. Yarnell posted on Tuesday, May 01, 2012 - 7:58 am
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.
 Bengt O. Muthen posted on Thursday, May 03, 2012 - 9:56 am
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
 Linda K. Muthen posted on Tuesday, May 06, 2014 - 10:28 am
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 a1-in1;
USEVARIABLES = a1-in1;
Missing are all (-66);
GROUPING IS loc (0=loc 1=glob);
MODEL: f1-f8 BY a1-in1(*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
 Linda K. Muthen posted on Thursday, May 08, 2014 - 2:17 pm
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
 Linda K. Muthen posted on Monday, May 12, 2014 - 6:12 am
Correct.
 Stephus Daus posted on Monday, June 23, 2014 - 5:02 pm
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:
Missflag-9
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
 Linda K. Muthen posted on Monday, June 23, 2014 - 5:52 pm
The FORMAT statement takes only one argument after the equal.

Regarding MISSFLAG, please send the output and your license number to support@statmodel.com.
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: