[R] how to test the random factor effect in lme
David Winsemius
dwinsemius at comcast.net
Wed Feb 15 03:28:00 CET 2012
On Feb 14, 2012, at 5:36 PM, Xiang Gao 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
Have you read what the unofficial Mixed Model FAQ says about testing
for significance on random effects?
http://glmm.wikidot.com/faq
>
> My R code so far can only test the fixed factor :
That may be the intent of the authors. They may want to make it
sufficiently difficult so that an adequate barrier prevents the
unwary from taking some "easy way out". You probably need to describe
your study (assuming this is not an assigned homework exercise) in
sufficient scientific detail and do so on the mixed-models mailing list.
--
David.
>
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list