95% CI of A,C,E estimates in Twin model

9 replies [Last post]
Sabha's picture
Offline
Joined: 05/18/2010

Can anyone help me with the function or syntex needed to calculate the 95% CI for A,C,E estimates in the existing
UnivariateTwinAnalysis_MatrixRaw.R script.

Thanks in advance.

danioreo's picture
Offline
Joined: 05/15/2014
Hi, I followed

Hi, I followed UnivariateTwinAnalysis_PathRaw.R instead of UnivariateTwinAnalysis_MatrixRaw.R.

I'm pretty new to OpenMx and R. Could anyone help me generate the 95%CI for standardized A, C, E? Thanks!

RobK's picture
Offline
Joined: 04/19/2011
Add algebras to your mxModel and request CIs for them

Do you want confidence intervals for the standardized path coefficients connecting the latent A, C, and E to the manifest variables? Or do you want confidence intervals for the standardized biometric variance components?

If you want them for the path coefficients, see my post in this other thread: http://openmx.psyc.virginia.edu/thread/2835 .

If you want them for the variance components, try adding something like the following to either your MZ-twin or DZ-twin submodel (it should not matter which):

mxMatrix(type="Full",nrow=3,ncol=1,free=T,values=.6,labels=c("a","c","e"),name="ace"),
mxAlgebra( (ace%^%2) %x% solve(t(ace)%*%ace), name="StdVarComp",dimnames=list(c("a2","c2","e2"),NULL) ),
mxCI("StdVarComp"),

I am assuming here that the single-headed paths going from the latent A, C, and E to the manifest variables are respectively labeled "a", "c", and "e", as in UnivariateTwinAnalysis_PathRaw.R . Also, depending on where in the mxModel() statement you put this code, you might need to delete that last comma. Then, when you use mxRun(), be sure to include argument intervals=TRUE. You can see the CIs in the output from summary(twinACEFit) or whatever.

What the code is doing is creating an mxMatrix to hold the path coefficients, because we're going to calculate something from them with an mxAlgebra, and algebras require matrices. What the algebra does is square each path coefficient, turning them into raw (unstandardized) variance components, and then divide them by the sum of their squares which is equal to the total phenotypic variance. The result is that raw variance components get divided by total variance, yielding standardized components--estimates of the phenotype's narrow-sense heritability, shared-environmentality, and unshared-environmentality.

danioreo's picture
Offline
Joined: 05/15/2014
Thank you for solving my problem

What I want are the confidence intervals for the standardized biometric variance components (a2, c2, e2). My problem got solved after adding your script to the original file. The instruction is very helpful and clear. Thank you so much for your help.

RobK's picture
Offline
Joined: 04/19/2011
You're welcome. Glad to be

You're welcome. Glad to be of help.

neale's picture
Offline
Joined: 07/31/2009
See this part of the wiki:
Sabha's picture
Offline
Joined: 05/18/2010
Thanks for your help. I was

Thanks for your help. I was able to get the CI for A,C,E. I also would like to get the CI for standardized components ( e.g ACE.A/V,ACE.C/ACE.V,ACE.E/ACE.V). How do I compute it.

tbates's picture
Offline
Joined: 07/31/2009
To add to mikes reply: You

To add to mikes reply: You will need to create these standardizing algebras in your model, if they are not already present.

i.e., you can't just ask for mxCI("ACE.A/ACE.Vtot"), you have to create
mxAlgebra(ACE.A/ACE.Vtot, name="stdA")
mxCI(c('stdA')

On that note, wouldn't it be great if you could just include things in the mxCI statement and they would be automagically created!!

All the information is there.

Sabha's picture
Offline
Joined: 05/18/2010
You spelled my wish.

You spelled my wish. Initially, I did try that way but it didn't work. Thanks a lot to both of you. It worked. Great help.

neale's picture
Offline
Joined: 07/31/2009
Same way, just use the names

Same way, just use the names of the algebras instead of the names of the matrices in the list of elements for which you would like the CIs.