[R] Rsquared for anova
    Ben Bolker 
    bbolker at gmail.com
       
    Mon Apr 18 15:12:14 CEST 2011
    
    
  
Dorien Herremans <dorien.herremans <at> ua.ac.be> writes:
> 
> Thanks Dieter,
> 
> Even if I use lm(), I get the following output:
> 
> > summary(fit)
>              Df  Sum Sq Mean Sq F value    Pr(>F)
> nh1            1   324.0  323.99  139.13 < 2.2e-16 ***
> nh2            1   723.1  723.12  310.53 < 2.2e-16 ***
> nh3            1  1794.2 1794.21  770.49 < 2.2e-16 ***
> Residuals   4604 10721.2    2.33
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’
> 
> no R squared to be found.
> 
  Really ??
  When I run the example in ?lm I get:
> summary(lm.D9)
Call:
lm(formula = weight ~ group)
Residuals:
    Min      1Q  Median      3Q     Max 
-1.0710 -0.4938  0.0685  0.2462  1.3690 
Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   5.0320     0.2202  22.850 9.55e-15 ***
groupTrt     -0.3710     0.3114  -1.191    0.249    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
Residual standard error: 0.6964 on 18 degrees of freedom
Multiple R-squared: 0.07308,	Adjusted R-squared: 0.02158 
F-statistic: 1.419 on 1 and 18 DF,  p-value: 0.249 
    Note the last three lines.  I would be shocked if there
weren't a similar set of information in your output ...
  Your output looks like the result of summary(aov(...))
> Another strange thing. I did the same calculations in SPSS and got
> different results, among others, higher p values. lm() and aov() just
> do linear regressions (anova) right? I tried with the same factorial
> variables (without interaction effects to test).
   There are a lot of things that could be different. Are
you treating factors (categorical predictors) as numeric by
accident?  
> 
> Thanks!
> 
> On 15 April 2011 18:07, Dieter Menne <dieter.menne <at> menne-biomed.de> wrote:
> >
> > dorien wrote:
> >>
> >> I calculate an anova test in the following way:
> >>
> >> ... aov example
> >>
> >> I want to check the fit of the model with Rsquared
> >>
> >
> > Try summary(lm(...)) instead.
> >
> > Dieter
> >
> >
> >
> > --
> > View this message in context:
http://r.789695.n4.nabble.com/Rsquared-for-anova-tp3452399p3452434.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > 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.
> >
> 
> --
> Dorien Herremans
> 
> Department of Environment, Technology and Technology Management
> Faculty of Applied Economics
> University of Antwerp
> 
> B.513
> Prinsstraat 13
> 2000 Antwerp
> Belgium
> +32 3 265 41 25
>
    
    
More information about the R-help
mailing list