[R] ANOVA between & within variance

Kingsford Jones kingsfordjones at gmail.com
Sat Sep 27 21:03:28 CEST 2008


So, rather than the estimated between and within group variances from
a standard fixed-effects ANOVA (i.e. the Mean Sqs in the anova table),
you are looking for the estimated variance components from a model
with crossed random effects?  If so, you may find the lmer function
found in package lme4 to be useful (formulas for crossed random
effects are much more straightforward than in nlme).  If not, this
page provides some helpful tips on eliciting useful responses from
this list: http://www.r-project.org/posting-guide.html

HTH,

Kingsford Jones

On Sat, Sep 27, 2008 at 2:21 AM, Gregor Rolshausen
<gregor.rolshausen at biologie.uni-freiburg.de> wrote:
> dear Dr. Kubovy,
>
> I am sorry. but the Variance table is not exactly what I want. I want
> the partitioned VARIANCE for between and within the groups. the anova
> ()-table just gives me the SumSq and the mean Sq... I know how to run
> t.test and ANOVA!
> in the nlme-package there is the VarCorr function, which extracts the
> between and within variances, but only for nested ANOVAs. so my
> question was, if there is a function like that for not-nested ANOVAS ?
>
> sorry. maybe I should reformulate the question.
>
> cheers ,
> gregor
>
>
>
>
>
>
> Am Sep 27, 2008 um 7:19 AM schrieb Michael Kubovy:
>
>> Than all you need is to run a t-test, no?  More generally (from ?lm):
>>
>> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
>> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
>> group <- gl(2,10,20, labels=c("Ctl","Trt"))
>> weight <- c(ctl, trt)
>> anova(lm.D9 <- lm(weight ~ group))
>> This gives you what you need:
>> Analysis of Variance Table
>>
>> Response: weight
>>           Df Sum Sq Mean Sq F value Pr(>F)
>> group      1   0.69    0.69    1.42   0.25
>> Residuals 18   8.73    0.48
>> I am concerned that you have not spent enough time either studying
>> stats or reading up on R. There are many good introductions to
>> stats using R.
>> _____________________________
>> Professor Michael Kubovy
>> University of Virginia
>> Department of Psychology
>> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
>> Parcels:    Room 102        Gilmer Hall
>>         McCormick Road    Charlottesville, VA 22903
>> Office:    B011    +1-434-982-4729
>> Lab:        B019    +1-434-982-4751
>> Fax:        +1-434-982-4766
>> WWW:    http://www.people.virginia.edu/~mk9y/
>>
>
> Gregor Rolshausen
> PhD Student
> Department of Evolutionary Ecology
> University of Freiburg im Breisgau; Hauptstrasse 1, 79108 Freiburg
> phone - +49.761.2559
> email - gregor.rolshausen at biologie.uni-freiburg.de
>
>
>
>
>        [[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.
>



More information about the R-help mailing list