On 18-Aug-10 07:42:23, Stephen Liu wrote: > Hi folks, > Where can I find document re "how to read anova output"? > Google found many of them. But seemingly non of them can > explain to me following output:- > >> tabA = c(5.67, 5.67, 5.55, 5.57) >> tabB = c(5.75, 5.47, 5.43, 5.45) >> tabC = c(4.74, 4.45, 4.65, 4.94) >> tabs = data.frame(tabA, tabB, tabC) > >> tablets = stack(tabs) > >> anova(lm(values ~ ind, data = tablets)) > Analysis of Variance Table > Response: values > Df Sum Sq Mean Sq F value Pr(>F) > ind 2 2.05787 1.02893 45.239 2.015e-05 *** > Residuals 9 0.20470 0.02274 > --- > Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The above is the basic standard format for the results of a 1-way analysis of variance (differences between means of groups compared with within-group differences between observations and group means). You need to understand how that works (basic statistical theory) before even thinking of looking at the Tukey thing (omitted in this reply). The following is an explanation of your 1-way ANOVA written entirely in R (preceded by a duplicate of your ANOVA output): ## anova(lm(values ~ ind, data = tablets)) ## Analysis of Variance Table ## Response: values ## Df Sum Sq Mean Sq F value Pr(>F) ## ind 2 2.05787 1.02893 45.239 2.015e-05 *** ## Residuals 9 0.20470 0.02274 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 tabA = c(5.67, 5.67, 5.55, 5.57) tabB = c(5.75, 5.47, 5.43, 5.45) tabC = c(4.74, 4.45, 4.65, 4.94) nA <- length(tabA) ; nB <- length(tabB) ; nC <- length(tabC) nG <- nA + nB + nC mG <- mean(c(tabA,tabB,tabC)) mA <- mean(tabA) ; mB <- mean(tabB) ; mC <- mean(tabC) SSres <- sum((tabA-mA)^2) + sum((tabB-mB)^2) + sum((tabC-mC)^2) SSres # = 0.2047 SSeff <- nA*(mA-mG)^2 + nB*(mB-mG)^2 + nC*(mC-mG)^2 SSeff # = 2.057867 ## Number of groups = 3 hence df.groups = (3-1) = 2 df.groups <- 2 meanSSeff <- SSeff/df.groups meanSSeff # = 1.028933 ## df for residuals in each group = (n.group - 1): df.res <- (nA-1) + (nB-1) + (nC-1) ## = 3 + 3 + 3 = 9 meanSSres <- SSres/df.res meanSSres # = 0.02274444 ## Fisher's F-ratio statistic = meanSSeff/meanSSres: F <- meanSSeff/meanSSres F # = 45.23889 ## P-value for F as test of difference between group means ## relative to within-group residuals (upper tail): Pval <- pf(F, df.groups, df.res, lower.tail=FALSE) Pval # = 2.015227e-05 Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 18-Aug-10 Time: 09:41:08 ------------------------------ XFMail ------------------------------ ______________________________________________ R-help@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.