Greetings -- After a few weeks of lurking, I have finally joined the board and I'm braving my first post! I've been struggling with a script that I know should be super simple and am hoping to get some assistance. I'm relatively new to R and to twin modeling, so it's entirely possible that I'm missing something very very basic.

My goal: I want to calculate the variance components for a simple dichotomous variable in which twins can answer in one of two ways -- yes or no. I want to run and compare ACE, AE, and CE models.

Thanks to what's available on this board, I was able to do this using the fabulous "UnivACE_MatrRawOrd.R" script (https://openmx.ssri.psu.edu/sites/default/files/UnivACE_MatrRawOrd.R).

I'm concerned about the influence of a covariate on "C," so I've decided to add it into the model. It's a continuous score on maternal aptitude so it's the same for both twins, the minimum value is 1.2.

I tried to tweak the script I found in this thread (https://openmx.ssri.psu.edu/thread/554) and at long last ended up with an ACE model that actually ran! However, I'm basically getting exactly the same results as without the covariate, which is weird. I'm wondering if something has gone wrong with

1) The way I have the covariate included in the model or

2) the way I'm setting up my data before creating the model. I'm starting with a .dat file without a header that contains 4 variables, and i'm naming them zyg, cast90_tw1, cast90_tw2, and read (which is the maternal aptitude score). When I initially ran the model without the covariate, I had to use mxfactor, but I'm not entirely sure if I'm using it correctly now.

My syntax for setting up the data and the ACE model is attached.

Any assistance would be extremely welcome!

Looks like it didn't attach.

I think you have used the wrong algebra for the mean, the one that doesn't have the definition variable piece (which is model-specific)

refers to the expCovMZ in the ACE model. However, what you want is the one in the MZ model (which happens to be the current model) so you should be saying

and do the same sort of thing for the DZ model.

Oh my goodness, thank you! It's working perfectly now.