[R] Random effect in ancova model

li li hannah.hlx at gmail.com
Sat May 2 06:46:26 CEST 2015


Hi all,
  I have the following data and would like to consider the following model:
  value = type + batch (type) + beta1* month +beta2*type*month+ error
Here type is fixed effect and batch is a random effect neste within type,
and month is continuous.
Since there is a random effect in this model. I am not too sure about the
right syntax in R.
Can anyone give some suggestions?
  Thank you.
    Hanna




 > mydata
      value type  batch month
 [1,]   0.2    1 178380     0
 [2,]   0.3    1 178380     3
 [3,]   0.3    1 178380     6
 [4,]   0.3    1 178380     9
 [5,]   0.3    1 178380    12
 [6,]   0.3    1 178380    15
 [7,]   0.4    1 178380    18
 [8,]   0.5    1 178380    24
 [9,]   0.2    1 189617     0
[10,]   0.3    1 189617     3
[11,]   0.4    1 189617     6
[12,]   0.4    1 189617     9
[13,]   0.4    1 189617    12
[14,]   0.4    1 189617    15
[15,]   0.4    1 189617    18
[16,]   0.4    1 189617    24
[17,]   0.2    1 197367     0
[18,]   0.3    1 197367     3
[19,]   0.3    1 197367     6
[20,]   0.4    1 197367     9
[21,]   0.4    1 197367    12
[22,]   0.4    1 197367    15
[23,]   0.4    1 197367    18
[24,]   0.4    1 197367    24
[25,]   0.4    2 286571     0
[26,]   0.4    2 286571     3
[27,]   0.3    2 286571     6
[28,]   0.4    2 286571     9
[29,]   0.4    2 286571    12
[30,]    NA    2 286571    15
[31,]   0.4    2 297299     0
[32,]   0.4    2 297299     3
[33,]   0.4    2 297299     6
[34,]   0.4    2 297299     9
[35,]   0.4    2 297299    12
[36,]    NA    2 297299    15

	[[alternative HTML version deleted]]



More information about the R-help mailing list