You are here

Bivariate ACE model with covariates for continuous and ordinal variables

5 posts / 0 new
Last post
YiTan's picture
Offline
Joined: 10/08/2014 - 05:28
Bivariate ACE model with covariates for continuous and ordinal variables

Hi,

I couldn't find any existing OpenMx codes to conduct bivariate genetic modelling for continuous and ordinal variables with covariates, so I've adapted Hermine Mae's twoACEvj.R code (bivariate ACE model for continuous and ordinal variables) by adding covariates to the code. I've done so by introducing separate regression coefficients for the continuous and ordinal variables. The code ran successfully, and the output seemed to be quite reasonable - the estimated ACE for the continuous variable was similar to the univariate ACE output, but the ordinal variable's estimated ACE was quite different: Bivariate's ACE output = (.61, 0, .39); Univariate ACE output = (.48, .11, .41).

If it helps, I have included a segment of my code with how I incorporated the covariates below. Any advice or comments will be greatly appreciated! Thanks!

# PREPARE MODEL
 
# Matrix for moderating/interacting variable
defSex    <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE,
                       labels=c("data.Sex1","data.Sex2"), name="Sex")
 
# Matrices declared to store linear Coefficients for covariate
B_SexOrd     <- mxMatrix( type="Full", nrow=nth, ncol=1, free=TRUE, 
                       values= .01, labels="betaSexOrd", name="bSexOrd")
 
B_SexCon     <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,F), 
                          values= c(.01, 0), labels=c('bSexV1','bSexV2'), name="bSexCon")
 
meanSexOrd   <- mxAlgebra(  bSexOrd%x%Sex, name="SexROrd")
meanSexCon   <- mxAlgebra(  bSexCon%x%Sex, name="SexRCon")
 
#age
defAge   <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE,
                      labels=c("data.Age1","data.Age2"), name="Age")
 
# Matrices declared to store linear Coefficients for covariate
B_AgeOrd     <- mxMatrix( type="Full", nrow=nth, ncol=1, free=FALSE, 
                       values= 0, labels="betaAgeOrd", name="bAgeOrd")
 
B_AgeCon     <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,F), 
                       values= c(.01,0), labels=c('bAgeV1','bAgeV2'), name="bAgeCon")
 
meanAgeOrd   <- mxAlgebra(  bAgeOrd%x%Age, name="AgeROrd")
meanAgeCon   <- mxAlgebra(  bAgeCon%x%Age, name="AgeRCon")
 
#YrsEd
defYEd   <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE,
                      labels=c("data.yrsEd1","data.yrsEd2"), name="YEd")
 
# Matrices declared to store linear Coefficients for covariate
B_YEdOrd     <- mxMatrix( type="Full", nrow=nth, ncol=1, free=FALSE,
                       values= 0, labels="betaYEdOrd", name="bYEdOrd")
B_YEdCon     <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,F),
                       values= c(.01, 0), labels=c('bYEdV1','bYEdV2'), name="bYEdCon")
 
meanYEdOrd   <- mxAlgebra(  bYEdOrd%x%YEd, name="YEdROrd")
meanYEdCon   <- mxAlgebra(  bYEdCon%x%YEd, name="YEdRCon")
 
#Age-related hearing condition
defAHearing   <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE,
                           labels=c("data.AHearing1","data.AHearing2"), name="AHearing")
 
# Matrices declared to store linear Coefficients for covariate
B_AHearingOrd     <- mxMatrix( type="Full", nrow=nth, ncol=1, free=TRUE, 
                            values= .01, labels="betaAHearOrd", name="bAHearingOrd")
B_AHearingCon     <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,F), 
                            values= c(.01, 0), labels=c('bAHearV1','bAHearV2'), name="bAHearingCon")
 
meanAHearingOrd   <- mxAlgebra(  bAHearingOrd%x%AHearing, name="AHearingROrd")
meanAHearingCon   <- mxAlgebra(  bAHearingCon%x%AHearing, name="AHearingRCon")
 
#Bilateral hearing condition
defBHearing   <- mxMatrix( type="Full", nrow=1, ncol=2, free=FALSE,
                           labels=c("data.BHearing1","data.BHearing2"), name="BHearing")
 
# Matrices declared to store linear Coefficients for covariate
B_BHearingOrd     <- mxMatrix( type="Full", nrow=nth, ncol=1, free=FALSE,
                            values= 0, labels="betaBHearOrd", name="bBHearingOrd")
B_BHearingCon     <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,F),
                            values= c(.01, 0), labels=c('bBHearV1','bBHearV2'), name="bBHearingCon")
 
meanBHearingOrd   <- mxAlgebra(  bBHearingOrd%x%BHearing, name="BHearingROrd")
meanBHearingCon   <- mxAlgebra(  bBHearingCon%x%BHearing, name="BHearingRCon")
 
# Matrix & Algebra for expected means vector and expected thresholds
intercept       <- mxMatrix( type="Full", nrow=1, ncol=ntv, free=c(T,F),
                             values=c(3,0), 
                             labels=c("meanP","binary"), name="intercept" )
threG    <- mxMatrix( type="Full", nrow=nth, ncol=nv, free=TRUE, values=svTh, lbound=lbTh, labels=labThZ, name="Thre" )
inc      <- mxMatrix( type="Lower", nrow=nth, ncol=nth, free=FALSE, values=1, name="Inc" )
threT    <- mxAlgebra( expression= Inc %*% Thre, name="expThre" )
threC <- mxAlgebra( expression = expThre + AgeROrd + SexROrd + YEdROrd + AHearingROrd + BHearingROrd, name = "expThreC")  #with covariates
 
expMean     <- mxAlgebra( intercept + AgeRCon + SexRCon + YEdRCon + AHearingRCon + BHearingRCon, name="expMean")
 
inclusions   <- list (defSex, B_SexOrd, B_SexCon, meanSexOrd, meanSexCon, defAge, B_AgeOrd, B_AgeCon, meanAgeOrd, meanAgeCon, 
                      defYEd, B_YEdOrd, B_YEdCon, meanYEdOrd, meanYEdCon, defAHearing, B_AHearingOrd, B_AHearingCon, meanAHearingOrd, meanAHearingCon,
                      defBHearing, B_BHearingOrd, B_BHearingCon, meanBHearingOrd, meanBHearingCon, expMean, intercept, threG, threT, threC)

And the specification for expMZ and expDZ:

# Objective objects for Multiple Groups
expMZ     <- mxExpectationNormal( covariance="expCovMZ", means="expMean",
                                  dimnames=c('Vars1','PVars1','Vars2','PVars2'),
                                  thresholds="expThreC",
                                  threshnames=c('PVars1','PVars2')
                                   )
 
 
expDZ     <- mxExpectationNormal( covariance="expCovDZ", means="expMean", 
                                  dimnames=c('Vars1','PVars1','Vars2','PVars2'),
                                  thresholds="expThreC",
                                  threshnames=c('PVars1','PVars2')
                                   )
AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
output?
Bivariate's ACE output = (.61, 0, .39); Univariate ACE output = (.48, .11, .41).

What exactly are these numbers?

YiTan's picture
Offline
Joined: 10/08/2014 - 05:28
ACE estimates of the ordinal variable

Hi Rob,

These are the ACE estimates of the ordinal variable from the bivariate and univariate analyses respectively.

I've attached the full R script if that helps.

Thank you very much for your help!
Yi Ting

File attachments: 
AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
Kronecker products

I can't be sure without the full script, but I bet my post in your other thread is relevant here, too, and may explain what's going on.

AdminNeale's picture
Offline
Joined: 03/01/2013 - 14:09
Bivariate analyses of

Bivariate analyses of continuous and ordinal variables can make the estimates of the ordinal variables change. I saw this with a quasi-continuous measure of depression and a binary measure of eating disorders, which were fairly rare in the population. In this circumstance, there can be more information for the ACE estimates of the binary variable in the cross-twin cross-variable MZ and DZ correlations than there is in the binary variable - binary variable correlation. That is, the cross-correlation may be more accurate. As a result, if the cross-variable cross-twin MZ and DZ correlations have a pattern of greater MZ than DZ correlation, the results will drift in that direction, i.e., more A and less other components. Bottom line: the results you have may look strange but are quite likely correct. https://vipbg.vcu.edu/vipbg/Articles/psychological-bulimia-1992.pdf