Re: [R] Within-subject factors in lme

From: <>
Date: Tue 16 Jan 2007 - 06:31:40 GMT

> Thanks for your suggestion. I guess the model you are fitting here
> has only a single random effect term, namely subject. If the effect
> of A depends on S, one needs to include an additional random effects
> term for the S:A interaction.

It is not quite clear what you are after, but the 'if' sounds as you would like to include interactions between your fixed and random effects? This is done in the following way:

lme (y ~ A + B, random= ~ A | S )
lme (y ~ A + B, random= ~ B | S )
lme (y ~ A + B, random= ~ A + B | S )

with redard to discussions on degrees of freedom (and thus testing in mixed-effects models) you may also want to refer to:

I hope this helps.
Regards, Lorenz Gygax
Swiss Federal Veterinary Office
Centre for proper housing of ruminants and pigs Agroscope Reckenholz-Tšnikon Research Station ART mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue Jan 16 17:37:11 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 16 Jan 2007 - 07:30:57 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.