Attachment | Size |
---|---|
DOC model .R [6] | 8.2 KB |
Hello,
I have a question regarding the Direction of Causation (DOC) model. I have found a very useful script at the following link and I'm trying to modify it according to my dataset: http://ibg.colorado.edu/cdrom2016/verhulst/Causation/DOC%20student.R.
I have 2 observed variables (x and y, both continuous) and I would like to verify if their association is causal (i.e. if x causes y. The inverse direction is not possible as x comes before y).
I have attached the modified script for you to have a look. When I run the Cholesky and the DOC models, I get this error:
"Error: Unknown expected covariance name 'expCovMZ' detected in the expectation function of model 'MZ'".
I suppose the problem is in the factor loadings function, but I can't fix it (probably because I'm not sure I understand what 'factor loadings' are). Can anyone help me?
Also, I would like to further modify this script in order to 1) control for a few confounding factors (of which only one- sex- can vary between co-twins) and 2) to control for the effect of a moderator (which does not vary between co-twins and is continuous) on the x variable only. Is it possible? Any suggestions will be much appreciated!
Thank you so much for your help!
Elena