# Troubleshooting covariate lines

Hi! I wanted to better understand lines 57 and 58 from Day3’s practical regarding the inclusion of age as a covariate.

The lines are:
defAge ← mxMatrix( type=“Full”, nrow=1, ncol=1, free=FALSE, labels=c(“data.age”), name=“defL” )
pathB ← mxMatrix( type=“Full”, nrow=1, ncol=1, free=TRUE, values=0.01, label=“b11”, name=“beta” )

1. Can you explain what each portion in the parenthesis is referring to. For instance, what is “data.age”?
2. Is pathB for the covariate?

Thanks!

1. Can you explain what each portion in the parenthesis is referring to. For instance, what is “data.age”?

OK. Consider `defAge`. `type="Full"` says that it is a “full” matrix, which can be of any dimensions, and in which every element may have a unique value. `nrow=1, ncol=1` says that it will have 1 row and 1 column. `free=FALSE` because it does not contain any free parameters. In the MxModel’s namespace, it will be named “defL”. That leaves the tricky part, `labels=c("data.age")`.

In an MxModel’s namespace, “data” always refers to the MxModel’s MxData object. Also, OpenMx interprets a period as meaning “member of”, a la C/C++. Thus, “data.age” refers to the variable damed “age” in the dataset.

Assuming the rows of the dataset are sampled independently, the -2logL of the full dataset is the sum of the -2logLs across all rows. That is, OpenMx evaluates the -2logL for each row, and sums them up to get the total -2logL. When OpenMx evaluates the -2logL for each row, the MxMatrix named “defL” will be populated with the value of the “age” variable specific to that row. Thus, the model-expected means for each row are conditioned upon each row’s value of age.

1. Is pathB for the covariate?

Yes. It contains the regression coefficient from the regression of the phenotype onto age.