[R] question about mixed effects model

Albedo albedo at pisem.net
Mon Mar 1 08:28:13 CET 2004


Hello.

I have some trouble with mixed effects in R, similar to problems
that other people had with not nested models and lme, as I
understand from the mailing list archive. Unfortunately, I could
not understand the solutions that were proposed...

I have a data set with response variable (y) and two explanatory
variables x1 and x2 (x1 - fixed factor, x2 - random factor). Fixed
factor x1 is repeated twice for each x2 value.

I believe that the correct way to fit a mixed model  would be

ddd <- groupedData(y ~ x1 | x2, dd)
l1 <- lme(y ~ x1, random = pdBlocked(list(pdIdent(~x2-1))), data = ddd)

But I get an error
Error in pdConstruct.pdBlocked(object, form = form, nam = nam, data =
data,  :    None of the arguments specify more than one block


I would also have to test for significance of each variable (x1 and x2)
and the way to do this seem to be to fit a model without x1 and compare
it to the original l1 model (and then the same for x2), but I can't seem
to find a way to do this.

Thanks a lot.




More information about the R-help mailing list