Ben,
I would like to test the sulfur on the clover field, nitrogen on the clover
field and then test for the presence of interaction.
Sorry about the last email, seems it really screwed itself over, here it is
again, hopefully nicer:
Nitrogen(0) Nitrogen(20)
Sulfur(0) 4.54 5.73
Sulfur(3) 4.64 7.05
Sulfur(6) 5.27 5.81
Sulfur(9) 5.81 6.30
Each of those is a cell mean of 3 values.
Would I simply do as follows?:
yield<- c(4.54,4.64,5.27,5.81,5.73,7.05,5.81,6.30)
sulfur <- c(1,2,3,4,1,2,3,4)
nitro <- c(1,1,1,1,2,2,2,2)
summary(aov(yield~sulfur*nitro))
Thanks, DM
----- Original Message ----
From: Ben Fairbank <BEN at SSANET.COM>
To: David Mackovjak <bejitto101 at yahoo.com>
Sent: Wednesday, March 19, 2008 3:14:36 PM
Subject: RE: [PS] [R] Two Way ANOVA
DM --
I think it would be helpful if you could also tell us what it is you are
hoping to find out from the analysis. For example, a statement such as
"I am seeking to find if there are any effects of the concentration (or
presence?) of nitrogen and/or sulfur on the (fill in your dependent
variable, such as 'cell division times' or 'changes in unbuffered
pH' or
whatever it is). That will help readers to see what design you need.
For example, do you want to look ONLY for an interaction, or do you want
to test for main effects of N and S also?
You might like to download Faraway's 2002 paper "Practical Regression
and Anova Using R" as start; google should find it for you.
Ben
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of David Mackovjak
Sent: Wednesday, March 19, 2008 5:02 PM
To: r-help at r-project.org
Subject: [PS] [R] Two Way ANOVA
First time using, the mailing list and I'm somewhat new to R, so excuse
me if I do anything wrong.
I was wondering how I would set up a two way ANOVA for the following
data:
Nitrogen
(0)
Nitrogen
(20)
(cell
means)
(cell
means)
[Sulfur means]
Sulfur (0)
4.48
5.76
4.52
(4.54)
5.64
(5.73)
[5.14]
4.63
5.78
Sulfur (3)
4.70
7.01
4.65
(4.64)
7.11
(7.05)
[5.84]
4.57
7.02
Sulfur (6)
5.21
5.88
5.23
(5.27)
5.82
(5.81)
[5.54]
5.38
5.73
Sulfur (9)
5.88
6.26
5.98
(5.81)
6.26
(6.30)
[6.11]
5.91
6.37
[Nitrogen means]
[5.10]
[6.22]
Source ofVariation SS
Sulfur 3.15
Nitrogen 7.59
Sulfur x Nitrogen 3.84
Error 0.08
Total 14.66
>From googling I know I want to get it to the form:
> fit <- aov(y ~ A*B, data=mydataframe)
But what would I set for A, B and y?
________________________________________________________________________
____________
Looking for last minute shopping deals?
______________________________________________
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.
____________________________________________________________________________________
Be a better friend, newshound, and
I do have the values for each individual values for each cell. They are as follows: N(0) N(20) 4.48 5.76 4.52 5.64 4.63 5.78 4.70 7.01 4.65 7.11 4.57 7.02 5.21 5.88 5.23 5.82 5.38 5.73 5.88 6.26 5.98 6.26 5.91 6.37 So how would I go about this then? ----- Original Message ---- From: Rolf Turner <r.turner at auckland.ac.nz> To: David Mackovjak <bejitto101 at yahoo.com> Sent: Wednesday, March 19, 2008 4:36:47 PM Subject: Re: [R] [PS] Two Way ANOVA With the given structure of your data you CANNOT test for interaction in the general sense. There are no degrees of freedom left for error. If you have access to the (three) individual values in each cell, then you can test for interaction. If these individual values are lost to posterity [Expostulation: Why the <expletive deleted> do people ***do*** things like this? Use your <expletive deleted> data, not summary statistics!!!] then you can still test for a ***particular form*** of interaction using Tukey's ``1 degree of freedom for non- additivity' test. I don't know if it's implemented in R, but it wouldn't be hard to roll your own. See ``Analysis of Messy Data'' volume 2 by George A. Milliken and Dallas E. Johnson, van Nostrand Reinhold, 1989, page 7 ff. On 20/03/2008, at 12:03 PM, David Mackovjak wrote:> Ben, > I would like to test the sulfur on the clover field, nitrogen on > the clover field and then test for the presence of interaction. > > Sorry about the last email, seems it really screwed itself over, > here it is again, hopefully nicer: > > Nitrogen(0) Nitrogen(20) > Sulfur(0) 4.54 5.73 > Sulfur(3) 4.64 7.05 > Sulfur(6) 5.27 5.81 > Sulfur(9) 5.81 6.30 > > Each of those is a cell mean of 3 values. > > Would I simply do as follows?: > > yield<- c(4.54,4.64,5.27,5.81,5.73,7.05,5.81,6.30) > sulfur <- c(1,2,3,4,1,2,3,4) > nitro <- c(1,1,1,1,2,2,2,2)Not quite; you need to make sulfur and nitro into ***factors***.> summary(aov(yield~sulfur*nitro))Better, I think, to use lm() directly rather than the aov() wrapper. fit <- lm(yield ~ sulfur*nitro) anova(fit) You see that you get no F-tests. The model fits ``perfectly'' so there is no residual sum of squares (and no degrees of freedom for error). cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:17}}