How can one use the matrices created by omxRAMtoML with the mxFIMLObjective?
mraw is my model as RAM.
When I use mrawML$covariance@name and mrawML$covariance@name as expected covariance and expected means, respectively, I get the error at the end of this post:
> mrawML <- omxRAMtoML(mraw)
> FIMLobjective <- mxFIMLObjective(covariance=mrawML$covariance@name,means=mrawML$means@name,dimnames=Namen)
> mrawMLwithFIML <- mxModel('Modell SES FIML', mraw, FIMLobjective)
> FitrawFIML <- mxRun(mrawMLwithFIML)
Running Modell SES FIML
Error: Unknown expected covariance name 'covariance' detected in the objective function of model 'Modell SES FIML'
Thanks in advance for any help!
In the future, I recommend posting your questions to the forums. New forum posts are noticed much faster than new comments to a wiki page. With regards to the issue at hand, you'll need to include the original model as the 1st argument to the mxModel() function in order to modify the existing model. As currently specified, you are constructing a new model with the objective function and data but it is missing all of the other matrices and algebras. Use the function mxRename() to give the model a new name, it will correct any internal references from the old name to the new name. I would write it as follows:
mrawMLwithFIML <- mxModel(mrawML, mraw, FIMLobjective)
mrawMLwithFIML <- mxRename(mrawMLwithFIML, 'Modell SES FIML')
In playing around with this example, I found that omxRAMtoML() has a bug and incorrectly throws an error if the input model has data with type='cov'. This will be corrected in OpenMx 1.2.5.