I calculate an anova test in the following way: expdata<-read.table("/home/dorien/UA/meta-music/optimuse/optimuse1-build-desktop/results/results_processedCP", header=TRUE) names(expdata)<-c('nh1','nh2','nh3','randsize','aweights','tt1','tt2','tt3','path','iters','type','length','tos','tws','time') fit<-(aov(tos~nh1*nh2*nh3*randsize*aweights*tt1*tt2*tt3*iters*length, data=expdata)) summary(fit) I want to check the fit of the model with Rsquared, but I cannot seem to find a way to do this... Any help is much appreciated... Thanks, Dorien [[alternative HTML version deleted]]
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.
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. The lm() output gives this:> 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 ?.? I just want to see how wel the model fits... 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). 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 -- 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
Dorien Herremans wrote:> > > 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 ?.? >You probably used the wrong fit. I get your results, when I use summary(aov), instead of summary(lm()) Dieter d = data.frame(nh1 = sample(letters[1:2],4000,TRUE), nh2 = sample(letters[1:2],4000,TRUE), nh3 = sample(letters[1:2],4000,TRUE), x = rnorm(4000)) summary(lm(x~nh1+nh2+nh3,data=d)) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.01517 0.03121 -0.486 0.627 nh1b 0.01990 0.03116 0.639 0.523 nh2b -0.02932 0.03116 -0.941 0.347 nh3b 0.02814 0.03116 0.903 0.367 Residual standard error: 0.9851 on 3996 degrees of freedom Multiple R-squared: 0.0005315, Adjusted R-squared: -0.0002189 F-statistic: 0.7083 on 3 and 3996 DF, p-value: 0.5469 summary(aov(x~nh1+nh2+nh3,data=d))> summary(aov(x~nh1+nh2+nh3,data=d))Df Sum Sq Mean Sq F value Pr(>F) nh1 1 0.4 0.40556 0.4179 0.5180 nh2 1 0.9 0.86530 0.8916 0.3451 nh3 1 0.8 0.79142 0.8155 0.3666 Residuals 3996 3878.2 0.97052>I suggest you kill your history file and your workspace, and try again from scratch. I never use these, but always start from scratch with my program (self-consistent) in the text editor. Dieter -- View this message in context: http://r.789695.n4.nabble.com/Rsquared-for-anova-tp3452399p3457451.html Sent from the R help mailing list archive at Nabble.com.