[R] Linear mixed model using R

Bert Gunter gunter.berton at gene.com
Fri Aug 17 07:16:36 CEST 2012


1. Post on R-sig-mixed-models, not here.

2. Models 2 and 3 make no sense (to me, anyway). What do you think
they mean? (Don't answer here -- explain on the mixed models list).

-- Bert

On Thu, Aug 16, 2012 at 9:13 PM, li li <hannah.hlx at gmail.com> wrote:
> Dear all,
>   I am trying to use R to fit mixed models.
>   Take the following example, where ind is a random effect and
> sample is fixed. I wanted to fit
>    Model 1: values = ind + sample
>    Model 2: values =ind * sample
>    Model 3:  values=ind(sample) + sample
>
> Tried to use the below for mod1, but it did not work.
 Can anyone give
> some help on this. Thanks so much.
> mod1 <- lme(values ~ sample +
>                      random=~ 1|ind, data=y)

Your syntax is wrong. Re-read ?lme
(random is a separate argument, not part of the formula).
>
>
>
>
>
>
>
>
>        values ind sample
> 1  0.03325   1      1
> 2  0.03305   1      1
> 3  0.03185   1      1
> 4  0.03515   1      1
> 5  0.03375   1      1
> 6  0.01180   1      2
> 7  0.01850   1      3
> 8  0.02915   1      4
> 9  0.06200   1      5
> 10 0.03230   2      1
> 11 0.03345   2      1
> 12 0.03385   2      1
> 13 0.03605   2      1
> 14 0.03225   2      1
> 15 0.01145   2      2
> 16 0.01805   2      3
> 17 0.02950   2      4
> 18 0.05995   2      5
> 19 0.03425   3      1
> 20 0.03575   3      1
> 21 0.03535   3      1
> 22 0.03380   3      1
> 23 0.03410   3      1
> 24 0.01050   3      2
> 25 0.01735   3      3
> 26 0.03140   3      4
> 27 0.06170   3      5
> 28 0.03430   4      1
> 29 0.03185   4      1
> 30 0.03165   4      1
> 31 0.03380   4      1
> 32 0.03235   4      1
> 33 0.01100   4      2
> 34 0.01825   4      3
> 35 0.03045   4      4
> 36 0.06060   4      5
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list