[R] 2 way repeated measures ANOVA using R: syntax and reporting question

GIDEON WASSERBERG wasserberg at wisc.edu
Wed May 26 21:03:21 CEST 2004


Dear Friends

I have a technical question about conducting 2 way repeated measures ANOVA analysis using R.

1. Data set: repeated measurement of activity over night (2 hr. intervals)
repeated (within subject)factor: Hours
Between subject: Species, Sex
Dependent variables: specimens

Here is how the data arranged for the analysis:

Subject	Replicate	Hour	Sp.	Specimens
1	1	       1	a	
2	1	       1	a	
3	1	       1	b	
4	1	       1	b	
5	2	       1	a	
6	2	       1	a	
7	2	       1	b	
8	2	       1	b	
1	1	       2	a	
2	1	       2	a	
3	1	       2	b	
4	1	       2	b	
5	2	       2	a
6	2	       2	a
7	2	       2	b
8	2	       2	b


here's the command I used: 
summary(aov(Specimens~Species*Sex*Hours+Error(Subject/Hours),data=SP)).

My question is - is that the correct way to do it??

2. Below is the results output:
A. I am not sure I understand what is the meaning of the two error terms I get. 
Does the first one show error between subjetcs
and the second - error within subjects?

Error: Subject - 
        Df  Sum Sq Mean Sq
Species  1 0.60715 0.60715

Error: Subject:Hours
      Df Sum Sq Mean Sq
Hours  1 158.24  158.24

Error: Within
                    Df Sum Sq Mean Sq F value    Pr(>F)    
Species              2  35.19   17.59 34.3017 2.733e-15 ***
Sex                  1  18.98   18.98 37.0092 1.493e-09 ***
Hours                1  40.02   40.02 78.0278 < 2.2e-16 ***
Species:Sex          2   1.29    0.64  1.2568    0.2849    
Species:Hours        2   9.95    4.97  9.6993 6.530e-05 ***
Sex:Hours            1   0.66    0.66  1.2778    0.2585    
Species:Sex:Hours    2   1.38    0.69  1.3498    0.2596    
Residuals         1486 762.20    0.51                      
---
B. How do I summarize this information for a report?
Is the below suggestion acceptable?
-------------------------------------------------------------------------------

Source	              df	SS	MS	                 F	    P
-----------------------------------------------------------------------------
Species	               2	35.19	17.59	                34.3     <0.0001
Sex          	       1	18.98	18.98	                37.01	  <0.0001
Species:Sex          	2	1.29	0.64  	               1.2568    0.2849    
Subject(Species)	1	0.60715	0.60715		
Subject(Hours)	       1	158.24  158.24  		
Hour	                1	40.02	  40.02	                78.0278	   <0.0001
Species:Hours        	2	9.95            4.97  	         9.6993	   <0.0001
Sex:Hours            	1	0.66    	0.66             1.2778    0.2585    
Species:Sex:Hours    	2	1.38    	0.69  	         1.3498	0.2596    
Residuals	     1486	762.20    	0.51 
---------------------------------------------------------------------------------                     		
Very much obliged for your kind response

Gideon


Gideon Wasserberg (Ph.D.)
Wildlife research unit,
Department of wildlife ecology,
University of Wisconsin
218 Russell labs, 1630 Linden dr.,
Madison, Wisconsin 53706, USA.
Tel.:608 265 2130, Fax: 608 262 6099




More information about the R-help mailing list