# Different age (covariate) for siblings

I’m working on the bivariate ACE model from 2016 Boulder workshop from Hermione Maes ‘twoSATja’ and ‘twoACEja’ (http://ibg.colorado.edu/cdrom2016/maes/UnivariateAnalysis/scriptsOpenMx.shtml). I use questionnaire data and some participants filled this out one or two years later than their twin siblings, this means that some siblings differ in age. How do I adjust the model to allow different ages between twins? I keep running into problems with non-conforming arrays…

Below the parts of the script that I have trouble adapting:

# Select Covariates for Analysis

ordData[,'age'] <- ordData[,'age']/100

ordData <- ordData[-which(is.na(ordData$age)),]

covVars <- c('age')

nc <- 2 # number of covariates

I adapted the above code to:

twindata$age1<-twindata$age1/100

twindata$age2<-twindata$age2/100

covVars <-c('age1', 'age2')

nc <-2

But I keep having trouble adapting the defAge, pathB and expMean in code below:

# PREPARE MODEL

```
```# ACE Model

# Create Matrices for Covariates and linear Regression Coefficients

defAge <- mxMatrix( type="Full", nrow=1, ncol=1, free=FALSE, labels=c("data.age"), name="Age" )

pathB <- mxMatrix( type="Full", nrow=nc, ncol=1, free=TRUE, values=.01, label=labBe, name="b" )

`# Create Algebra for expected Mean Matrices`

meanG <- mxMatrix( type="Full", nrow=1, ncol=ntv, free=frMV, values=svMe, labels=labMe, name="meanG" )

expMean <- mxAlgebra( expression= meanG + cbind(t(b%*%Age),t(b%*%Age)), name="expMean" )

thinG <- mxMatrix( type="Full", nrow=nth, ncol=ntvo, free=TRUE, values=svTh, lbound=lbTh, labels=labTh, name="thinG" )

inc <- mxMatrix( type="Lower", nrow=nth, ncol=nth, free=FALSE, values=1, name="inc" )

threG <- mxAlgebra( expression= inc %*% thinG, name="threG"

Thanks for you help!

## Try this

defAge <- mxMatrix( type="Full", nrow=1, ncol=4, free=FALSE, labels=c("data.age1","data.age1","data.age2","data.age2"), name="Age" )

pathB <- mxMatrix( type="Full", nrow=1, ncol=4, free=TRUE, values=.01, label=c("beta1","beta2","beta1","beta2"), name="b" )

expMean <- mxAlgebra( expression= meanG + (b*Age), name="expMean" )

Log in or register to post comments