Adding a covariate

I have been learning how to structure the analyses and scripts for examining twin data and I am having some trouble with 'adding a covariate'. When I run the following code.(which I didn't write)...............
mxModel("Sibs",
mxMatrix( type="Lower", nrow=ntv, ncol=ntv, free=TRUE, values=1, name="Chol" ),
mxAlgebra( expression=Chol %*% t(Chol), name="expCov" ),
#regressing out covariate
mxMatrix( type="Full", nrow=1, ncol=ntv, free=TRUE, values=0, labels="intercept", name="grandMean" ),
# adding a beta x covariate to full mean
mxMatrix(type="Full", nrow=cov, ncol=nv, free=TRUE, labels="betaSes", name="regBetas"),
........it will not run past the last line, and I receive the following error message..........
dding a beta x covariate to full mean
> mxMatrix(type="Full", nrow=cov, ncol=nv, free=TRUE, labels="betaSes", name="regBetas")
Error in matrix(values, nrow, ncol, byrow = byrow) :
non-numeric matrix extent
In addition: Warning messages:
1: In is.na(nrow) :
is.na() applied to non-(list or vector) of type 'closure'
2: In is.na(nrow) :
is.na() applied to non-(list or vector) of type 'closure'
3: In is.na(nrow) :
is.na() applied to non-(list or vector) of type 'closure'
Help or suggestions to improve the 'functionality' of the code will be greatly appreciated.
Best wishes
jane
The variable 'cov' is bound
Log in or register to post comments
mxMatrix(type="Full",
The parameter nrow takes a number, but instead it is being passed "cov" which by default is the function for computing covariance.
Likely it is a typo for "nCov"or some similar variable name in which the script writer has stored the number of covariates.
Log in or register to post comments
Thankyou. I had added some
regards
jane
Log in or register to post comments