Re: [R] [PS] Two Way ANOVA

From: Daniel Malter <daniel_at_umd.edu>
Date: Wed, 19 Mar 2008 20:38:46 -0400


You put all the responses into one vector and the appropriate independents Sulfur and nitrogen into the other. So your table would look like this (see below). You would test.

summary(aov(Dependent~factor(Nitrogen)*factor(Sulfur))). And your output would look likt this (see further below) from which you can start in-depth analyses.

Dependent	Nitrogen	Sulfur
4.48	1	1
4.52	1	1
4.63	1	1
4.7	1	2
4.65	1	2
4.57	1	2
5.21	1	3
5.23	1	3
5.38	1	3
5.88	1	4
5.98	1	4
5.91	1	4
5.76	2	1
5.64	2	1
5.78	2	1
7.01	2	2
7.11	2	2
7.02	2	2
5.88	2	3
5.82	2	3
5.73	2	3
6.26	2	4
6.26	2	4
6.37	2	4


                                Df Sum Sq Mean Sq F value    Pr(>F)    
factor(Nitrogen)                 1 7.5937  7.5937 1514.96 < 2.2e-16 ***
factor(Sulfur)                   3 3.1543  1.0514  209.76 4.717e-13 ***
factor(Nitrogen):factor(Sulfur)  3 3.8358  1.2786  255.08 1.024e-13 ***
Residuals                       16 0.0802  0.0050                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

 


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] Im
Auftrag von David Mackovjak
Gesendet: Wednesday, March 19, 2008 7:55 PM
An: Rolf Turner; R-help_at_r-project.org
Betreff: Re: [R] [PS] Two Way ANOVA

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}} ______________________________________________ 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. ______________________________________________ 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.
Received on Thu 20 Mar 2008 - 00:42:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Mar 2008 - 01:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive