I am working on the ACE model. I want to evaluate the age effect on the ACE model. Additionally, I need to eliminate the age effect. How can I do this work. Many thanks.

Here's a simple twin-analysis script that should help you get started. Notice that it includes the regression of the phenotype onto age as part of the model for the phenotypic mean. You'd get the MZ and DZ correlations by converting the estimated covariance matrices for MZ and DZ twins into correlation matrices.

Hi Robert,
Your script also works for me.
You mentioned "it includes the regression of the phenotype onto age as part of the model for the phenotypic mean". Did you refer to the following script? What does it mean? Do I need to delete the "cbind(b%%Age,b%%Age)"?

Additionally, how could I convert the covariance matrices into correlation matrices in OpenMx? Or it should be done by other softwares, such as Matlab?

The script I attached to my previous post is written for the case that both twins in a pair have the same age, which may or may not apply to your case.

This line creates an MxMatrix which will contain the age of the current twin pair, as taken from the raw dataset, when the OpenMx backend evaluates the likelihoods of each row of the dataset at runtime. The fact that the label begins with "data." makes age what is known as a "definition variable," because the model applied to each row (i.e., each twin pair) is conditionally defined based on the value of age in that row of the dataset:

This line is creating an MxAlgebra that will evaluate to a vector with two elements, each of which equals the regression intercept plus the effect of age. Thus, the model-expected phenotypic mean for each twin pair is conditionally defined by age.

Hi,

I also want to know if the rMZ and rDZ can be calculated in openMX? Thank you.

Bo

Here's a simple twin-analysis script that should help you get started. Notice that it includes the regression of the phenotype onto age as part of the model for the phenotypic mean. You'd get the MZ and DZ correlations by converting the estimated covariance matrices for MZ and DZ twins into correlation matrices.

Hi Robert,

Your script also works for me.

You mentioned "it includes the regression of the phenotype onto age as part of the model for the phenotypic mean". Did you refer to the following script? What does it mean? Do I need to delete the "cbind(b%

%Age,b%%Age)"?expMeanMZ <- mxAlgebra( expression= meanMZ + cbind(b%

%Age,b%%Age), name="expMeanMZ" )expMeanDZ <- mxAlgebra( expression= meanDZ + cbind(b%

%Age,b%%Age), name="expMeanDZ" )or

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

expMean <- mxAlgebra( expression= mean + cbind(b%

%Age,b%%Age), name="expMean" )Additionally, how could I convert the covariance matrices into correlation matrices in OpenMx? Or it should be done by other softwares, such as Matlab?

Thank you.

The script I attached to my previous post is written for the case that both twins in a pair have the same age, which may or may not apply to your case.

This line creates an MxMatrix which will contain the age of the current twin pair, as taken from the raw dataset, when the OpenMx backend evaluates the likelihoods of each row of the dataset at runtime. The fact that the label begins with

`"data."`

makes age what is known as a "definition variable," because the model applied to each row (i.e., each twin pair) is conditionally defined based on the value of age in that row of the dataset:This line is creating an MxMatrix that contains the regression coefficient for age:

This line is creating an MxMatrix that contains the regression intercept:

This line is creating an MxAlgebra that will evaluate to a vector with two elements, each of which equals the regression intercept plus the effect of age. Thus, the model-expected phenotypic mean for each twin pair is conditionally defined by age.

To get the twin correlations, you could add an MxAlgebra to your model that converts the covariance matrix to a correlation matrix, e.g.

Or, you could apply the conversion from the R prompt after running your model, e.g.

Hi Bo

It seems that a workshop on methods for twin research might be a good thing for you to attend. There will be one in Boulder, CO March 7-11 2016.