# RAM Cholesky Decomposition

8 posts / 0 new
Offline
Joined: 12/09/2019 - 12:01
RAM Cholesky Decomposition

Hello,

I am playing around with different kinds of twin models which I try to implement using the RAM-matrix approach, but not defining the expectation object with mxExpectationRAM(), but with mxExpectationNormal(). My idea is to create the A, S (one for MZs and one for DZs) and F matrices as well as the Identity matrix with the mxMatrix() functions and then creating the expected covariance matrices for MZs and DZs with the mxAlgebra() function following the RAM matrix formula.

It may be some more coding compared to the "normal" matrix approach, but my hope is that the model specified this way can be easily extended: You can simply add covariates into the covariance matrix, define the ACE decomposed variable as a latent factor etc.. I am aware that you can do the same things with the "normal" matrix approach, but following the RAM logic you just have to modify the three matrices accordingly and the formula to create the expected covariance matrices remains the same.

For a first univariate model this works fine. My questions is about implementing a bivariate model. Leohlin (1996; doi: 10.1007/BF02361160) presents different parametrizations of the same multivariate model. I think the correlated factor solution where you specify the covariances between the ACE factors instead of the cross paths can be implemented without problems with the RAM-matrices. But I am not sure how to implement the Cholesky parametrization using the RAM matrices. I am aware of the problems of the Cholesky approach as discussed in Verhulst et al. (2019; doi: 10.1007/s10519-018-9942-y), but for the sake of completeness I am interested in implementing the Cholesky approach with the RAM matrices.

EDIT: To make my point more clearly: Just filling the A matrix with the path coefficients is straightforward. But I am not sure if it is right because there is no explicit multiplication of two lower triangluar matrices. So I was wondering whether I have to rebuild the A matrix in order to ensure this multiplication. But maybe I am on the wrong track here?

Offline
Joined: 05/24/2012 - 00:35
Cholesky

The model expected covariance for RAM is F (I − A)^{−1} S (I − A)^{−T} F^T. Suppose S is set to the identity matrix. If you put a Cholesky factor in the (I − A)^{−1} term then it is multiplied with itself. See twoACEc.R at Hermine's script collection

Offline
Joined: 12/09/2019 - 12:01
I see, but if I set S to the

I see, but if I set S to the identity, wouldn't that mean that the off-diagonals are zero including the covariances of the latent A's and C's and the diagonals including the error variances of the manifests are set to one?

Offline
Joined: 05/24/2012 - 00:35
see example

I'm not sure whether I follow. Here's some code to play with.

File attachments:
Offline
Joined: 12/09/2019 - 12:01
Thanks for the code. Now I

Thanks for the code. Now I see your point, but I still doubt what are the steps to come to the point where I have all the matrices necessary for the colesky style computation. In the concrete case of a bivariate cholesky model I have 4 observed and 12 latent variables, so 16 in total. That is, my A, S and I matrices have a shape of 16x16, the F matrix of 4x16. I suppose that I have to divide these original matrices to get into the starting position for a Cholesky decomposition with the RAM-matrices? Attached you find the script with the "normal" RAM matrices which may help following my question. The results I get seem valid.

File attachments:
Offline
Joined: 05/24/2012 - 00:35
mxPath?

Are you trying to re-express the model in mxPath notation? I don't think this is currently possible. You can only express the model in matrix algebra.

Offline
Joined: 12/09/2019 - 12:01
No, I want to use the matrix

No, I want to use the matrix algebra with mxExpectationNormal() using the RAM matrix approach (not mxExpectationRAM()) but I am not sure whether the script I posted above does properly address the Cholesky decomposition.

Offline
Joined: 12/09/2019 - 12:01
Comparison RAM, LISREL, manual

Now I wrote a script with LISREL matrices and calculated a bivariate model using the matrix approach within OpenMx. I compared the results with the model with RAM matrices and the "manual" matrix approach with an adapted script by Hermine Maes (I adapted the starting values and switched from mxRun to mxTryHard). The models have the same fit and the coefficients and SEs are quite similar. All in all, it seems to me that using the RAM or LISREL matrices for the matrix approach seems to be ok, since the results are comparable to the scripts whith the "manual" matrices. But maybe I am missing something?

File attachments: