# [R] is this an ANOVA ?

Bill.Venables at csiro.au Bill.Venables at csiro.au
Thu Apr 14 00:21:48 CEST 2011

```You probably want to do something like this:

> fm <- lm(y ~ x, MD)
> anova(fm)
Analysis of Variance Table

Response: y
Df Sum Sq Mean Sq F value    Pr(>F)
x          2    250   125.0      50 1.513e-06
Residuals 12     30     2.5

1. No.
2. Yes.

(whoever you are).

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ubuntu Diego
Sent: Wednesday, 13 April 2011 10:10 AM
To: r-help at r-project.org
Subject: [R] is this an ANOVA ?

Hi all,
I have a very easy questions (I hope). I had measure a property of plants, growing in three different substrates (A, B and C). The rest of the conditions remained constant. There was very high variation on the results.
I want to do address, whether there is any difference in the response (my measurement) from substrate to substrate?

x<-c('A','A','A','A','A','B','B','B','B','B','C','C','C','C','C') # Substrate type
y <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) # Results of the measurement
MD<-data.frame(x,y)

I wrote a linear model for this:

summary(lm(y~x,data=MD))

This is the output:

Call:
lm(formula = y ~ x, data = MD)

Residuals:
Min         1Q     Median         3Q        Max
-2.000e+00 -1.000e+00  5.551e-17  1.000e+00  2.000e+00

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)   3.0000     0.7071   4.243 0.001142 **
xB            5.0000     1.0000   5.000 0.000309 ***
xC           10.0000     1.0000  10.000 3.58e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.581 on 12 degrees of freedom
Multiple R-squared: 0.8929,	Adjusted R-squared: 0.875
F-statistic:    50 on 2 and 12 DF,  p-value: 1.513e-06

I conclude that there is an effect of substrate type (x).
NOW the questions :
1) Do the fact that the all p-values are significant means that all the groups are different from each other ?
2) Is there a (easy) way to plot,  mean plus/minus 2*sd for each substrate type ? (with asterisks denoting significant differences ?)

THANKS !

version
platform       x86_64-apple-darwin9.8.0
arch           x86_64
os             darwin9.8.0
system         x86_64, darwin9.8.0
status
major          2
minor          11.1
year           2010
month          05
day            31
svn rev        52157
language       R
version.string R version 2.11.1 (2010-05-31)

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help