[R-sig-ME] corSymm in lme model returns error

Julia Dechamps julia.dechamps at jesus.ox.ac.uk
Thu Aug 18 15:17:22 CEST 2011


Dear list,

I am trying to fit a two-level random effects model with a fixed general correlation structure to my data (22 observations in total occurring in 4 groups), using lme.

Without the correlation structure, the model can be fitted as follows: lme(avg ~ 1, data=regIIsp, random= ~1 | Level3Name).

The correlation matrix I now want to use for my 22 random effects (at the lower level) is a positive definite 22x22 matrix which has the values 0 and 0.28 as off-diagonal elements in a certain arrangement. I called the matrix mycorrII. I created my correlation structure using the corSymm class as follows (where I don´t want to specify any groups for now):

mycorrstrucII <- corSymm(value=mycorrII[col(mycorrII)<row(mycorrII)], form=~1, fixed=TRUE)

Since I supplied the value argument and set fixed=TRUE, I believe I do not need to initialize the matrix?
When trying to initialize nevertheless, I get the following error:
Error in getClass(Class) :
  c("\"corSymm\" is not a defined class", "\"corStruct\" is not a defined class")
In addition: Warning message:
In if (!is.na(match(Class, .BasicClasses))) return(newBasic(Class,  :
  the condition has length > 1 and only the first element will be used

When trying to retrieve my correlation matrix using corMatrix(mycorrstrucII), I get the following error:
Error in getCovariate.corStruct(object) :
  Need data to calculate covariate of corStruct object

I do not understand what is meant by calculating a covariate of the corStruc object.

When I try to fit my lme model with the specified correlation structure via: lme(avg ~ 1, data=regIIsp, random= ~1 | Level3Name, correlation=mycorrstrucII), I get the following error:
Error in Initialize.corSymm(X[[2L]], ...) :
  Initial value for corSymm parameters of wrong dimension

But my (initial) value, i.e. mycorrII[col(mycorrII)<row(mycorrII)], has length 231 which should be the right dimension (all elements below the main diagonal in the 22x22 matrix mycorrII).

Could anyone help me understand where I have gone wrong?
I greatly appreciate any advice, thank you so much in advance!!

Kind Regards,
Julia




More information about the R-sig-mixed-models mailing list