[R] Mixed Models providing a correlation structure.

Marcio mresende at ufl.edu
Wed Jul 11 16:27:21 CEST 2012


Dear Simon,
Thanks for the quick reply.
Unfortunately I don't have access to Pinheiro and Bates. I tried googling
the pdSymm and lme but I still cannot get the syntax right.

In my model, I only have 1 random factor with repetitions (groups) (e.g. 2
records per each level)
I am pasting bellow a very small example (2 records and 2 levels) which
demonstrates the error I am having.
The syntax of lme is obviously wrong, and any help would be appreciated:

Thanks

> #Example
> CovM <- matrix(c(1,0.5,0.5,1),2)
> CovM
     [,1] [,2]
[1,]  1.0  0.5
[2,]  0.5  1.0
> DATA <- data.frame(Y = c(rnorm(4)), Random = c(1,1,2,2))
> DATA
            Y              Random
1  0.24037680      1
2  0.03477704      1
3 -1.83389279      2
4 -0.84793117      2
> lme(Y~Random, data = DATA, random = list(Random = pdSymm
> (CovM[lower.tri(CovM)],~Random)))
Error in `Names<-.pdMat`(`*tmp*`, value = c("(Intercept)", "Random")) : 
  Length of names should be 1

--
View this message in context: http://r.789695.n4.nabble.com/Mixed-Models-providing-a-correlation-structure-tp4635569p4636141.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list