[R] lme random interactions

Thierry Onkelinx thierry.onkelinx at inbo.be
Tue Mar 17 09:42:59 CET 2015

Dear Brian,

You want

data$CompLab <- interaction(data$Compound, data$Lab)
lme ( data=data, Resp ~ Lab * Compound,
   random = list(CombLab = ~ 1, Date = pdIdent(~0 + Lab)) ,
    weights = varIdent(form=~1|Lab)

Note that this is untested since you didn't provide a reproducible example.

However, you have only very few levels of Date. See "Should I treat factor
xxx as fixed or random?" on http://glmm.wikidot.com/faq
Furthermore, you are estimating a lot of parameters. Make you that you have
enough data.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-03-16 11:10 GMT+01:00 Middleton, Brian J <
Brian.Middleton op astrazeneca.com>:

> I have a method comparison problem, comparing Labs where a set of
> compounds are assayed on 3 different dates for each lab. Both labs will be
> used to assess compounds in the future, so the scientists will potentially
> contrast a compound at assayed at Lab A with one assayed at Lab B, This
> implies I ought to regard the Lab*Compound interaction as random. I also
> have the date within Lab as a random term and the Compound*date as random
> (and as separate variances for each Lab).
> If I regard the Compound*Lab effect as fixed this code works
> lme.out <- lme ( data=data, Resp ~ Lab + Compound + Compound:Lab,
>    random = pdIdent(~Lab-1|Date)  ,
>     weights = varIdent(form=~1|Lab)
> )
> The trouble is when I try to regard it as random, eg.
> lme2.out <- lme ( data=data, Resp ~ Lab + Compound,
>    random = list( ~Compound:Lab,  pdIdent(~Lab-1|Date)  ),
>     weights = varIdent(form=~1|Lab)
>   )
> It appears as if the random interaction is not allowed ... Is this right ?
> Is there a way to fit the interaction as random together with the other
> random terms ?
> I have tried lme4 but note that "lme4 does not currently implement nlme's
> features for modeling heteroscedasticity" but "does implement crossed
> random effects". No joy in my hands though. Nor with lmer ...
> Any help gratefully received, thanks,
> Brian (trying to convert from SAS !)
> ________________________________
> AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:26}}
> ______________________________________________
> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

	[[alternative HTML version deleted]]

More information about the R-help mailing list