[R] aov for a split plot design

Bill.Venables@CMIS.CSIRO.AU Bill.Venables at CMIS.CSIRO.AU
Wed Mar 13 07:00:37 CET 2002


I don't have Kirk but with your data in file "Kirk.txt" in the working
directory, here is how I would do it.

---
> Kirk <- read.table("Kirk.txt")
> names(Kirk)
[1] "subject"  "A"        "B"        "C"        "response"
> for(j in 1:4) Kirk[,j] <- factor(Kirk[,j])  ### Check this!
> fm <- aov(response ~ A*B*C + Error(subject), Kirk)
> summary(fm)

Error: subject
          Df Sum Sq Mean Sq F value Pr(>F)
A          1 3.1250  3.1250       2 0.2070
Residuals  6 9.3750  1.5625               

Error: Within
          Df  Sum Sq Mean Sq  F value    Pr(>F)
B          1 162.000 162.000 319.5616 6.626e-13
C          1  24.500  24.500  48.3288 1.704e-06
A:B        1   6.125   6.125  12.0822 0.0026970
A:C        1  10.125  10.125  19.9726 0.0002966
B:C        1   8.000   8.000  15.7808 0.0008929
A:B:C      1   3.125   3.125   6.1644 0.0231183
Residuals 18   9.125   0.507                   
>
---

An alternative formula would be response ~ A/(B*C) + Error(subject), which
would only change things by grouping together some of the sums of squares.

In my experience the most common mistake people make with this kind of
example is way before the analysis stage.  They forget to make the factors
into factors.  This would not matter much here for A, B and C since they are
only binary, but if subject were not declared a factor the result would be
very different (and quite silly).

Bill Venables.



-----Original Message-----
From: rab [mailto:rab at nauticom.net]
Sent: Wednesday, March 13, 2002 11:45 AM
To: r-help at stat.math.ethz.ch
Subject: [R] aov for a split plot design


I have data with factor A between subjects and factors B*C within 
subjects. The data are taken from an example in Kirk:

 > kirk.sp
   subject A B C response
1        1 1 1 1        3
2        1 1 1 2        4
3        1 1 2 1        7
4        1 1 2 2        7
5        2 1 1 1        6
6        2 1 1 2        5
7        2 1 2 1        8
8        2 1 2 2        8
9        3 1 1 1        3
10       3 1 1 2        4
11       3 1 2 1        7
12       3 1 2 2        9
13       4 1 1 1        3
14       4 1 1 2        3
15       4 1 2 1        6
16       4 1 2 2        8
17       5 2 1 1        1
18       5 2 1 2        2
19       5 2 2 1        5
20       5 2 2 2       10
21       6 2 1 1        2
22       6 2 1 2        3
23       6 2 2 1        6
24       6 2 2 2       10
25       7 2 1 1        2
26       7 2 1 2        4
27       7 2 2 1        5
28       7 2 2 2        9
29       8 2 1 1        2
30       8 2 1 2        3
31       8 2 2 1        6
32       8 2 2 2       11

There are eight subjects, 2 levels of A, 2 levels of B and 2 levels of C.

How does one set up the formula in aov to properly analyze this data? 
I've tried various representation using the Error function and nesting 
but I can't duplicate the analysis shown in Kirk (1968, p. 302, 
Experimental Design).

I would greatly appreciate any insights. I've looked at other split plot 
designs in V&R but can't translate it.

Rick Bilonick

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list