Phasing Out RAM To FIML Transformation

mspiegel's picture

In the OpenMx 1.0.x series, when a RAM model with raw data is fitted, the resulting model that is returned by mxRun() has a FIML objective function instead of a RAM objective function. This transformation was performed for convenience, it allowed us to support RAM models with raw data by using our existing implementation for FIML optimization. However it has been a source of confusion (rightly so) as new paths cannot be added or eliminated from the resulting fitted model. The OpenMx platform encourages a workflow where model A can be fitted to produce model B, and then model B is modified and then fitted to produce model C, ad infinitum.

Starting in OpenMx 1.1, a RAM model with raw data will no longer produce a fitted model with a FIML objective function. This is strictly an issue of user interface, the optimization strategy will not change. What does this mean for the user? You will no longer be able to inspect the "expCov" and "expMean" algebras of the fitted model that have been auto-generated in OpenMx 1.0.x. In order to inspect the final values of the expected covariance and expected means in a fitted RAM model, use the following syntax model$objective@expCov or model$objective@expMean. Note this works for covariance data or raw data, something that was not possible in the 1.0 series.

If your workflow demands access to the intermediate values of the expCov and expMean algebras during the optimization process, then you will need to use the function newModel <- omxRAMtoML(model). This function accepts a model as input, and returns a model as output where all the RAM objective functions have been transformed to either ML or FIML objective functions, where the necessary algebras have been auto-generated in order to calculate the expected covariance and means matrices.

Comments

neale's picture

covariance not precomputed unless re-run

I kinda wanted the predicted covariance matrix without too much fuss, but....

> mlthreeLatentMultipleReg1Out<-omxRAMtoML(threeLatentMultipleReg1Out)
> mxEval(covariance,mlthreeLatentMultipleReg1Out)
<0 x 0 matrix>
> mlthreeLatentMultipleReg1Out <- mxRun(mlthreeLatentMultipleReg1Out)
Running threeLatentMultipleReg 
> mxEval(covariance,mlthreeLatentMultipleReg1Out)
           X1         X2        X3        X4        X5         X6        X7        X8        X9       X10       X11
X1  3.0625478 1.56064008 2.2151889 2.5180936 0.1533993 0.12353111 0.1889941 0.1824992 1.9813124 1.7333723 1.5585098
X2  1.5606401 2.33001701 1.7921357 2.0371921 0.1241034 0.09993934 0.1529003 0.1476458 1.6029245 1.4023356 1.2608681
X3  2.2151889 1.79213566 3.6076425 2.8916119 0.1761536 0.14185494 0.2170283 0.2095700 2.2752079 1.9904899 1.7896894
X4  2.5180936 2.03719213 2.8916119 4.3406748 0.2002408 0.16125217 0.2467047 0.2382266 2.5863196 2.2626693 2.0344114
X5  0.1533993 0.12410336 0.1761536 0.2002408 2.1644830 1.06046665 1.6224409 1.5666848 0.7533809 0.6591033 0.5926130
X6  0.1235311 0.09993934 0.1418549 0.1612522 1.0604666 1.61577260 1.3065373 1.2616374 0.6066910 0.5307701 0.4772260
X7  0.1889941 0.15290030 0.2170283 0.2467047 1.6224409 1.30653728 3.1852673 1.9302182 0.9281954 0.8120417 0.7301229
X8  0.1824992 0.14764579 0.2095700 0.2382266 1.5666848 1.26163739 1.9302182 2.8738210 0.8962974 0.7841354 0.7050318
X9  1.9813124 1.60292454 2.2752079 2.5863196 0.7533809 0.60669099 0.9281954 0.8962974 4.0201855 2.6925629 2.4209373
X10 1.7333723 1.40233564 1.9904899 2.2626693 0.6591033 0.53077009 0.8120417 0.7841354 2.6925629 3.3266341 2.1179828
X11 1.5585098 1.26086809 1.7896894 2.0344114 0.5926130 0.47722603 0.7301229 0.7050318 2.4209373 2.1179828 2.7846315
X12 1.3905242 1.12496413 1.5967859 1.8151302 0.5287376 0.42578773 0.6514259 0.6290393 2.1599941 1.8896939 1.6990616
          X12
X1  1.3905242
X2  1.1249641
X3  1.5967859
X4  1.8151302
X5  0.5287376
X6  0.4257877
X7  0.6514259
X8  0.6290393
X9  2.1599941
X10 1.8896939
X11 1.6990616
X12 2.4719909

mspiegel's picture

Maybe this will

Maybe this will work:

mlthreeLatentMultipleReg1Out <- omxRAMtoML(threeLatentMultipleReg1Out)
mxEval(covariance, mlthreeLatentMultipleReg1Out, compute=TRUE)

The flag compute=TRUE will evaluate any algebras in the frontend. Otherwise (compute=FALSE) returns the current value of the MxAlgebra.