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

Greg Snow 538280 at gmail.com
Wed Feb 15 22:37:06 CET 2012


This post https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001819.html
may help you understand why the standard p-values in some cases are
not the right thing to do and what one alternative is.

On Tue, Feb 14, 2012 at 3:36 PM, Xiang Gao <xianggao2006 at gmail.com> wrote:
> 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
>
> ______________________________________________
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list