Hi,
I am trying to get the CI for correlations in trivariate model. I did get them in my univariate models and tried to readjust the script to my multivariate models:
Algebra for expected Means, Covariances and Correlation Matrices in MZ & DZ twins
Saturated_Model <- mxModel("Saturated",
mxModel("MZM", mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE,
values=svMe, labels=c("MZM1_1","MZM1_2","MZM2_1","MZM2_2","MZM3_1","MZM3_2"),
name="expMeanMZM" ),
mxMatrix( type="Symm", nrow=ntv, ncol=ntv, free=TRUE,
values=c(68,6,1,41,4,1,
6,8,3,5,2.7,2.5,
1,3,12,1,2,3.5,
41,5,1,68,6,1,
4,2.7,2,6,8,3,
1,2.5,3.5,1,3,12), lbound=lbVa,
labels=c("vaMZM1_1","pcMZM1_1","pcMZM2_1","ctMZM11","cttMZM12","cttMZM13",
"pcMZM1_1","vaMZM2_1","pcMZM3_1","cttMZM21","ctMZM22","cttMZM23",
"pcMZM2_1","pcMZM3_1","vaMZM3_1","cttMZM31","cttMZM32","ctMZM33",
"ctMZM11","cttMZM21","cttMZM31","vaMZM1_2","pcMZM1_2","pcMZM2_2",
"cttMZM12","ctMZM22","cttMZM32","pcMZM1_2","vaMZM2_2","pcMZM3_2",
"cttMZM13","cttMZM23","ctMZM33","pcMZM2_2","pcMZM3_2","vaMZM3_2"), name="expCovMZM" ),
Matrix and algebra to calculate expected correlations
mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I"),
mxAlgebra( solve(sqrt(IexpCovMZM)), name="iSDmzm"),
mxAlgebra( iSDmzm%%expCovMZM%*%iSDmzm, name="expCorMZM"),
Specify data and fit function to fit model to data
mxData(mzmData, type="raw"),
mxFIMLObjective(covariance="expCovMZM", means="expMeanMZM", dimnames=selVars)),
------------------------------------------------------------------------------------------
(...)
mxAlgebra(MZM.objective + DZM.objective + MZF.objective + DZF.objective + DOSmf.objective , name="modelfit"), #specifiy total model fit function
mxAlgebraObjective("modelfit"),
mxCI(c("MZM.expCorMZM", "DZM.expCorDZM", "MZF.expCorMZF", "DZF.expCorDZF","DOSmf.expCorDOSmf")))
Run the saturated model
Saturated_Model_Fit <- mxRun(Saturated_Model, intervals = T)
however I am getting the following error:
Error: The following error occurred while evaluating the subexpression 'MZM.I * MZM.expCovMZM' #during the evaluation of 'MZM.iSDmzm' in model 'Saturated' : non-conformable arrays.
Any help will be appreciated!