You are here

ACE estimates for multiple variables.

1 post / 0 new
Sabha's picture
Joined: 05/18/2010 - 15:46
ACE estimates for multiple variables.


I need help with how to estimate the A, C,E for multiple variables and store them in a table format.
I have a example data with two values for each twin pair for 5 genes ( A,B,C,D,E).

I started out in following way from the Twin Univariate model script but it's not working.
Data Varsi for(i in 1:5){
nv selVars mzDatai dzDatai #-- Data Summary------

#---ACE Model----
univACEModel mxModel("ACE",
# Matrices a, c, and e to store a, c, and e path coefficients
mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=.6, label="a11", name="a" ),
mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=.6, label="c11", name="c" ),
mxMatrix( type="Full", nrow=nv, ncol=nv, free=TRUE, values=.6, label="e11", name="e" ),
# Matrices A, C, and E compute variance components
mxAlgebra( expression=a %*% t(a), name="A" ),
mxAlgebra( expression=c %*% t(c), name="C" ),
mxAlgebra( expression=e %*% t(e), name="E" ),
# Algebra to compute total variances and standard deviations (diagonal only)
mxAlgebra( expression=A+C+E, name="V" ),
mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I"),
mxAlgebra( expression=solve(sqrt(I*V)), name="sd"),

# Matrix & Algebra for expected means vector
mxMatrix( type="Full", nrow=1, ncol=nv, name="M" ),
mxAlgebra( expression= cbind(Mean,Mean), name="expMean" ),
mxMatrix( type="Full", nrow=1, ncol=nv, free=TRUE, values=20, label="mean", name="Mean" ),
mxAlgebra( expression= cbind(Mean,Mean), name="expMean" ),
# Algebra for expected variance/covariance matrix in MZ
mxAlgebra( expression= rbind ( cbind(A+C+E , A+C),
cbind(A+C , A+C+E)), name="expCovMZ" ),
# Algebra for expected variance/covariance matrix in DZ, note use of 0.5, converted to 1*1 matrix
mxAlgebra( expression= rbind ( cbind(A+C+E , 0.5%x%A+C),
cbind(0.5%x%A+C , A+C+E)), name="expCovDZ" )
mxData( observed=mzDatai, type="raw" ),
mxFIMLObjective( covariance="ACE.expCovMZ", means="ACE.expMean", dimnames=selVars )
mxData( observed=dzDatai, type="raw" ),
mxFIMLObjective( covariance="ACE.expCovDZ", means="ACE.expMean", dimnames=selVars)
mxAlgebra( expression=MZ.objective + DZ.objective, name="sumll" ),
mxCI(c('ACE.A', 'ACE.C', 'ACE.E','ACE.V'))
univACEFit univACESumm univACESumm
# Generate Table of Parameter Estimates using mxEval
pathEstimatesACE varComponentsACE rownames(pathEstimatesACE) colnames(pathEstimatesACE) rownames(varComponentsACE) colnames(varComponentsACE) pathEstimatesACE

Any help would be of great help for highthroughput data with ACE estimation for large no.of variables( genes).