[R] how to test the random factor effect in lme

Xiang Gao xianggao2006 at gmail.com
Tue Feb 14 23:36:25 CET 2012


Hi

I am working on a Nested one-way ANOVA. I don't know how to implement
R code to test the significance of the random factor

My R code so far can only test the fixed factor :

anova(lme(PCB~Area,random=~1|Sites, data = PCBdata))
            numDF denDF   F-value p-value
(Intercept)     1    12 1841.7845  <.0001
Area              1     4    4.9846  0.0894


Here is my data and my hand calculation.

> PCBdata
   Area Sites PCB
1     A     1  18
2     A     1  16
3     A     1  16
4     A     2  19
5     A     2  20
6     A     2  19
7     A     3  18
8     A     3  18
9     A     3  20
10    B     4  21
11    B     4  20
12    B     4  18
13    B     5  19
14    B     5  20
15    B     5  21
16    B     6  19
17    B     6  23
18    B     6  21

By hand calculation, the result should be:
Source	SS	DF	MS
Areas      18.00  1    18.00
Sites        14.44  4    3.61
Error        20.67  12  1.72
Total	        53.11   17   ---


MSareas/MSsites = 4.99 --- matching the R output
MSsites/MSE = 2.10
Conclusion is that Neither of Areas nor Sites make differences.


My R code so far can only test the fixed effect :

anova(lme(PCB~Area,random=~1|Sites, data = PCBdata))
            numDF denDF   F-value p-value
(Intercept)     1    12 1841.7845  <.0001
Area              1     4    4.9846  0.0894



-- 
Xiang Gao, Ph.D.
Department of Biology
University of North Texas



More information about the R-help mailing list