Dear reader,
Currently I am struggling with computing factor scores with maximum likelihood estimation using the mxFactorScores(model, type="ML") function. If I understand it correctly, the input model should include a means vector for the indicators. However, because my indicators are categorical I fit my model with mxFitFunctionWLS() and specify the data with mxDataWLS(data,type="WLS"). To my knowledge the mxDataWLS() function does not allow the specification of the means. As a result my model does not provide the means necessary to use the mxFactorScores() function.
Do you know a solution to my problem?
Best,
Paul
What version of the package are you running? You can use
mxVersion()
to see.OpenMx version: 2.5.2 [GIT v2.5.2]
R version: R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0
MacOS: 10.11.6
Default optimiser: SLSQP
Version 2.5.2 is almost a year and a half old. I'd say the first thing to try is to update OpenMx and then see if it can do what you want.
Thanks, I updated the OpenMx R-package, but encountered the same problem as described in my opening post.
Sorry that factor scores aren't working for this problem! I think your explanation of the problem is incorrect. WLS data does include means. Without even the error/warning message this problem is hard to diagnose. However, here's an example of fitting a model with WLS, swapping in raw data, and then fitting ML factor scores to the WLS estimated model.
It's worth mentioning that this is a strange thing to do. ML factor scores from the WLS model might not behave well. I don't think it has been studied.
Another point to consider, your ML model might run faster with better starting values. From the example above,
The model
m0s
is an ML model with pretty good starting values. Many times this makes the ML estimation faster.Thanks for the reply! I used your script to compute the factor scores, but R returns an error when fitting the WLS model: "Error: The row names of the LX matrix and the row names of the TX matrix in model 'WLSFactorModel' do not contain identical names."
After I constrain these rownames to be equal I receive a different error: "Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings,: Observed thresholds were provided, but an expected thresholds matrix was not specified.
If you provide observed thresholds, you must specify a model for the thresholds."
You mention that estimating ML factor scores is a strange thing to do for a WLS model. What do you think would be the best method to compute factor scores for a WLS model?
I'm sorry I walked you into that problem! There was a bug in LISREL WLS models that was fixed here. This fix will be part of the next release, probably in the next 2-3 weeks. In the meantime, if you specify a non-LISREL model it will work. Using
type='RAM'
withmxPath
statements or usingmxExpectationRAM
will specify a RAM model.No problem! And thanks, it works now using the RAM specification.