Hello,
First a thank you to this great forum! I am a beginner at twin model and have found it very helpful. I recently ran the Univariate Sex Limitation Model script http://www.vipbg.vcu.edu/HGEN619_2014/twinHet5AceCon.R At the end one runs a Homogeneity ACE model. My understanding is this should produce the same results as running the OpenMx ACE tutorial limited to just the young twins from the psych package, and excluding the opposite sex pairs. https://openmx.ssri.psu.edu/docs/openmx/latest/GeneticEpi_Matrix.html
However, when I compare the results while the estimates for A and E are similar, the estimate for C is not. Am I wrong in expecting these two models to match?
I have copied below the OpenMx tutorial script that I altered to use just the young MZ and DZ(same sex) twins from the psych package. I also included the results the two model compared.
Forgive me if this is has an obvious answer, I am very new to twin modeling. :)
Thank you!!
Brittany
------------------------------------------------------------------------------
MODEL COMPARISONS
Homogeneity ACE Model
round(HomoAceFit@output$estimate,4)
a11 c11 e11 meanf meanm
0.7510 0.0000 0.4083 21.3820 21.7235
OpenMx Univariate ACE Model
round(AceFit@output$estimate,4)
a11 c11 e11 mean
0.6036 0.4895 0.3989 21.4973
------------------------------------------------------------------------------
OPENMX TUTORIAL WITH YOUNG TWINS
------------------------------------------------------------------------------
require(OpenMx)
Select Variables for Analysis
Vars <- 'bmi' #this way the next expected number is either 1 or two for the selection below
nv <- 1 # number of variables
ntv <- nv*2 # number of total variables
selVars <- paste(Vars,c(rep(1,nv),rep(2,nv)),sep="") #c('T1tw1','T1tw2')
selVars
Select Data for Analysis
mzData <- subset(twinData, zyg==1 | zyg==2, selVars)
dzData <- subset(twinData, zyg==3 | zyg==4, selVars)
nrow(mzData) #569+273=842
nrow(dzData) #351+206=557
Set Starting Values
svMe <- 20
svPa <- 0.6 # start value for path coefficients (sqrt(variance/#ofpaths))
ACE Model
Matrices declared to store a, d, and e Path Coefficients
pathA <- mxMatrix( type="Full", nrow=nv, ncol=nv,
free=TRUE, values=svPa, label="a11", name="a" )
pathC <- mxMatrix( type="Full", nrow=nv, ncol=nv,
free=TRUE, values=svPa, label="c11", name="c" )
pathE <- mxMatrix( type="Full", nrow=nv, ncol=nv,
free=TRUE, values=svPa, label="e11", 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
covP <- mxAlgebra( expression=A+C+E, name="V" )
Algebra for expected Mean and Variance/Covariance Matrices in MZ & DZ twins
meanG <- mxMatrix( type="Full", nrow=1, ncol=ntv,
free=TRUE, values=svMe, label="mean", name="expMean" )
free=TRUE, values=svMedz, label="meandz", name="expMeandz" )
covMZ <- mxAlgebra( expression=rbind( cbind(V, A+C),
cbind(A+C, V)), name="expCovMZ" )
covDZ <- mxAlgebra( expression=rbind( cbind(V, 0.5%x%A+ 0.25%x%C),
cbind(0.5%x%A+ 0.25%x%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
expMZ <- mxExpectationNormal( covariance="expCovMZ", means="expMean",
dimnames=selVars )
expDZ <- mxExpectationNormal( covariance="expCovDZ", means="expMean",
dimnames=selVars )
funML <- mxFitFunctionML()
Combine Groups
pars <- list( pathA, pathC, pathE, covA, covC, covE, covP )
modelMZ <- mxModel( pars, meanG, covMZ, dataMZ, expMZ, funML, name="MZ" )
modelDZ <- mxModel( pars, meanG, covDZ, dataDZ, expDZ, funML, name="DZ" )
fitML <- mxFitFunctionMultigroup(c("MZ.fitfunction","DZ.fitfunction") )
AceModel <- mxModel( "ACE", pars, modelMZ, modelDZ, fitML )
Run ADE model
AceFit <- mxRun(AceModel, intervals=T)
AceSum <- summary(AceFit)
AceSum
round(AceFit@output$estimate,4)