Quantcast

interpreting one-way anova tables

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

interpreting one-way anova tables

Jabez Wilson
Hi, I am trying to reconcile anova table in R (summary(lm)) with individual t.test.
datafilename="http://personality-project.org/R/datasets/R.appendix1.data"
data.ex1=read.table(datafilename,header=T)   #read the data into a table
summary(lm(Alertness~Dosage,data=data.ex1))

gives:

Call:
lm(formula = Alertness ~ Dosage, data = data.ex1)

Residuals:
   Min     1Q Median     3Q    Max
-8.500 -2.437  0.250  2.687  8.500

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   32.500      2.010  16.166 6.72e-11 ***
Dosageb       -4.250      2.659  -1.598 0.130880   
Dosagec      -13.250      3.179  -4.168 0.000824 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 4.924 on 15 degrees of freedom
Multiple R-squared: 0.5396,     Adjusted R-squared: 0.4782
F-statistic: 8.789 on 2 and 15 DF,  p-value: 0.002977

As far as I understand it the lines "Dosageb" and "DosageC" represent the difference between DosageA and the other two dosages.
My question is this: are these differences and the p-values associated with them the same as a t.test or pairwise.t.test on these groups? If I do t.tests, I get different values for t and p-value from those in the anova table above.
Can someone please explain what the discrepancy is?
Thanks



     
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: interpreting one-way anova tables

Thomas Lumley
On Mon, 20 Sep 2010, Jabez Wilson wrote:

> Hi, I am trying to reconcile anova table in R (summary(lm)) with individual t.test.
> datafilename="http://personality-project.org/R/datasets/R.appendix1.data"
> data.ex1=read.table(datafilename,header=T)   #read the data into a table
> summary(lm(Alertness~Dosage,data=data.ex1))
>
> gives:
>
> Call:
> lm(formula = Alertness ~ Dosage, data = data.ex1)
>
> Residuals:
> ???? Min???????? 1Q Median???????? 3Q?????? Max
> -8.500 -2.437?? 0.250?? 2.687?? 8.500
>
> Coefficients:
> ?????????????????????? Estimate Std. Error t value Pr(>|t|)??????
> (Intercept)???? 32.500?????????? 2.010?? 16.166 6.72e-11 ***
> Dosageb???????????? -4.250?????????? 2.659?? -1.598 0.130880??????
> Dosagec?????????? -13.250?????????? 3.179?? -4.168 0.000824 ***
> ---
> Signif. codes:?? 0 ???***??? 0.001 ???**??? 0.01 ???*??? 0.05 ???.??? 0.1 ??? ??? 1
>
> Residual standard error: 4.924 on 15 degrees of freedom
> Multiple R-squared: 0.5396,???????? Adjusted R-squared: 0.4782
> F-statistic: 8.789 on 2 and 15 DF,?? p-value: 0.002977
>
> As far as I understand it the lines "Dosageb" and "DosageC" represent the difference between DosageA and the other two dosages.
> My question is this: are these differences and the p-values associated with them the same as a t.test or pairwise.t.test on these groups? If I do t.tests, I get different values for t and p-value from those in the anova table above.


The t tests in the table use all the data to estimate a residual variance that is used to calculate the standard error, whereas t.test() uses just two groups.  If you use pairwise.t.test() with pool.sd=TRUE you will get the same p-values.

There is another reason for the difference from t.test(), which is that t.test() does not assume equal variance in the outcome across groups.  If you were to use vcovHC(,type="HC0") from the 'sandwich' package to estimate the standard errors in the linear model these would also not assume equal variance.  The tests would still not be identical, although they would be very similar in large samples.  The reasons they would not be identical are
   - some differences in using n vs n-p vs n1+n2-2 in denominators
   - different approximations to the denominator degrees of freedom.


       -thomas

Thomas Lumley
Professor of Biostatistics
University of Washington, Seattle

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: interpreting one-way anova tables

David Winsemius
In reply to this post by Jabez Wilson

On Sep 20, 2010, at 11:53 AM, Jabez Wilson wrote:

> Hi, I am trying to reconcile anova table in R (summary(lm)) with  
> individual t.test.
> datafilename="http://personality-project.org/R/datasets/R.appendix1.data 
> "
> data.ex1=read.table(datafilename,header=T)   #read the data into a  
> table
> summary(lm(Alertness~Dosage,data=data.ex1))

The quick answer is that in the ANOVA situation where you are  
interpreting individual level parameters, you are testing for the  
difference of a particular group from a shared mean (the intercept)  
across all three groups, whereas with the t-test you are only  
considering two groups at a time. (The default treatment contrasts do  
not actually result in the intercept estimate being a global mean,  
however.)

--
David.

>
> gives:
>
> Call:
> lm(formula = Alertness ~ Dosage, data = data.ex1)
>
> Residuals:
>    Min     1Q Median     3Q    Max
> -8.500 -2.437  0.250  2.687  8.500
>
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept)   32.500      2.010  16.166 6.72e-11 ***
> Dosageb       -4.250      2.659  -1.598 0.130880
> Dosagec      -13.250      3.179  -4.168 0.000824 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Residual standard error: 4.924 on 15 degrees of freedom
> Multiple R-squared: 0.5396,     Adjusted R-squared: 0.4782
> F-statistic: 8.789 on 2 and 15 DF,  p-value: 0.002977
>
> As far as I understand it the lines "Dosageb" and "DosageC"  
> represent the difference between DosageA and the other two dosages.
> My question is this: are these differences and the p-values  
> associated with them the same as a t.test or pairwise.t.test on  
> these groups? If I do t.tests, I get different values for t and p-
> value from those in the anova table above.
> Can someone please explain what the discrepancy is?
> Thanks
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.
Loading...