You are here

Error: The data object 'MZ.data' contains an observed matrix that is not of type 'double'

5 posts / 0 new
Last post
Luntary's picture
Offline
Joined: 02/17/2016 - 13:02
Error: The data object 'MZ.data' contains an observed matrix that is not of type 'double'

Hi Everybody!!!
I'm really naive using OpenMx. So probably my question is a silly mistake. Any way;

I try to perform a twin analysis with sex and age as covariates. I have used the script "UnivariateTwinAnalysis_MatrixRaw-3" from Dr. neale that I found in this forum. But I don't want generate sex and age data because I have mine. So I changed a bit the script.


summary(test)
selVars <- c('hear1','hear2')
mzData <- as.matrix(subset(test, zyg==1, c(hear1,hear2,sex1,sex2,age1,age2)))
dzData <- as.matrix(subset(test, zyg==2, c(hear1,hear2,sex1,sex2,age1,age2)))
colMeans(mzData,na.rm=TRUE)
colMeans(dzData,na.rm=TRUE)
cov(mzData,use="complete")
cov(dzData,use="complete")

head(mzData)
head(dzData)


I haven't change any more in the script. However when I run the script I have the following Error message:
Error: The data object 'MZ.data' contains an observed matrix that is not of type 'double'

Any suggestions to fix it??

Thank you so much in advance!!

Luntary's picture
Offline
Joined: 02/17/2016 - 13:02
Sorry for the inconvenience

Sorry for the inconvenience and solve it!
But now I have another question.
It is possible to add a extra covariate, the third one ? I mean, a variable that a symptom is present or absent. And if so it must be defined as 0 and 1 or 1 and 2 (like sex)?

Thanks you so much!

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
third covariate
It is possible to add a extra covariate, the third one ?

It certainly is. You'd need to edit the MxMatrices named 'MZDefVars', 'DZDefVars', and 'beta' to accommodate the new variable. For instance,

mxMatrix( type="Full", nrow=3, ncol=2, free=F, label=c("data.ageT1MZ","data.sexT1MZ","data.symptomT1MZ","data.ageT2MZ","data.sexT2MZ","data.symptomT2MZ"), name="MZDefVars")

and

mxMatrix( type="Full", nrow=1, ncol=3, free=TRUE, values= 0, label=c("betaAge","betaSex","betaSymptom"), name="beta")

And if so it must be defined as 0 and 1 or 1 and 2 (like sex)?

0 & 1 would provide the easiest interpretation, I'd say.

Luntary's picture
Offline
Joined: 02/17/2016 - 13:02
Thanks!!!!!!!!!!!

Thanks!!!!!!!!!!!

neale's picture
Offline
Joined: 07/31/2009 - 15:14
umx

I think this is an area where umx is of value in that it brings a higher level function which takes an argument as to the list of covariates to use. The headache of getting the rows & columns of matrices of covariates and their corresponding beta weights and algebra right has been solved for the general case.