multivariate (4) ACE model confidence intervals for standardized A,C,E

2 replies [Last post]
jwee2's picture
Offline
Joined: 07/01/2014

Greetings, fairly new student of OpenMx here. I've successfully run a univariate twin model with confidence intervals thanks to mxCI, but in the quadvariate script below (obtained from http://ibg.colorado.edu/cdrom2014/bartels/Multivariate/Trivariate.R), I don't know where to put the mxCI command to request CIs for A/V, C/V, and E/V. The output is in the form of a matrix too, so I am unsure how to proceed. Any assistance would be greatly appreciated.

# Matrices declared to store a, c, and e Path Coefficients
pathA <- mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE,
values=svPa, labels=labLower("a",nv), lbound=lbPa, name="a" )
pathC <- mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE,
values=svPa, labels=labLower("c",nv), lbound=lbPa, name="c" )
pathE <- mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE,
values=svPa, labels=labLower("e",nv), lbound=lbPa, name="e" )

# Matrices generated to hold A, C, and E computed Variance Components
covA <- mxAlgebra( expression=a %*% t(a), name="A" )
covC <- mxAlgebra( expression=c %*% t(c), name="C" )
covE <- mxAlgebra( expression=e %*% t(e), name="E" )

# Algebra to compute total variances and standard deviations (diagonal only)
covP <- mxAlgebra( expression=A+C+E, name="V" )
matI <- mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I")
invSD <- mxAlgebra( expression=solve(sqrt(I*V)), name="iSD")

# Algebra for expected Mean and Variance/Covariance Matrices in MZ & DZ twins
meanG <- mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE,
values=svMe, labels=labFull("me",1,nv), name="expMean" )
covMZ <- mxAlgebra( expression= rbind( cbind(V, A+C), cbind(A+C, V)), name="expCovMZ" )
covDZ <- mxAlgebra( expression= rbind( cbind(V, 0.5%x%A+C), cbind(0.5%x%A+C, V)), name="expCovDZ" )

# Data objects for Multiple Groups
dataMZ <- mxData( observed=mzData, type="raw" )
dataDZ <- mxData( observed=dzData, type="raw" )

# Objective objects for Multiple Groups
objMZ <- mxFIMLObjective( covariance="expCovMZ", means="expMean", dimnames=selVars )
objDZ <- mxFIMLObjective( covariance="expCovDZ", means="expMean", dimnames=selVars )

# Combine Groups
pars <- list( pathA, pathC, pathE, covA, covC, covE, covP, matI, invSD, meanG )
modelMZ <- mxModel( pars, covMZ, dataMZ, objMZ, name="MZ" )
modelDZ <- mxModel( pars, covDZ, dataDZ, objDZ, name="DZ" )
minus2ll <- mxAlgebra( expression=MZ.objective + DZ.objective, name="m2LL" )
obj <- mxAlgebraObjective( "m2LL" )
CholAceModel <- mxModel( "CholACE", pars, modelMZ, modelDZ, minus2ll, obj )

# ------------------------------------------------------------------------------
# RUN GENETIC MODEL

# Run Cholesky Decomposition ACE model
CholAceFit <- mxRun(CholAceModel)

mhunter's picture
Offline
Joined: 07/31/2009
Try this

The following code should get you confidence intervals on the StandardizedA algebra in the submodel MZ.

avMZ <- mxAlgebra(A/V, name="StandardizedA")
avMZ_CI <- mxCI("StandardizedA")
modelMZ <- mxModel( pars, covMZ, dataMZ, objMZ, avMZ, avMZ_CI, name="MZ" )

Similar expressions would be possible for other algebras. Confidence intervals work on "named entities" within a model. So you can get a confidence interval on any algebra, matrix, or free parameter by creating an mxCI object that refers to the entity by name and putting the mxCI in the same model as the entity.

jwee2's picture
Offline
Joined: 07/01/2014
An update to my situation, I

An update to my situation, I discovered that the summary of the multivariate fit path model through summary(CholeAceFit) provides 'free parameter' estimates for all paths, including their standard error. My advisor says that presenting un-standardized estimates in a path model with confidence intervals calculated using those standard errors provided is fine. So although the original question was not solved, my problems overall have been remedied! :)