[R] Mixed Models providing a correlation structure.
Kevin Wright
kw.stat at gmail.com
Thu Jul 12 00:49:00 CEST 2012
Why did you use the 'lower.tri' syntax?
Does this work for you?
lme(Y~Random, data = DATA,
random = list(Random = pdSymm(CovM,~Random)))
Kevin
On Wed, Jul 11, 2012 at 9:27 AM, Marcio <mresende at ufl.edu> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Kevin Wright
More information about the R-help
mailing list