[R] Nested ANOVA residuals error

Jeff DaCosta
Thu, 16 Jul 2009 19:36:53 -0000

I am having trouble setting up a nested anova model.  Here is a
truncated version of my data:

 > data
      Ind Treatment         PC1
1  PER14        SC  1.14105282
2  PER14        SH  1.45348615
3  PER14        AC  2.45096904
4  PER25        SC  1.23687887
5  PER25        SH  4.54797450
6  PER25        AC -0.73391131
7  PER30        SC  1.15899433
8  PER30        SH  2.83273736
9  PER30        AC -0.86272186
10 PER31        SC  1.90495285
11 PER31        SH  5.68514429
12 PER31        AC -2.25110314
13 PER35        SC  2.16463279
14 PER35        SH  1.69053389
15 PER35        AC  1.87528942
16 PER36        SC -2.44795781
17 PER36        SH -3.59415298
18 PER36        AC  1.90756192
19 PER41        SC -2.83086573
20 PER41        SH  4.26803170
21 PER41        AC  2.42548862
22 PER48        SC -1.86403368
23 PER48        SH -0.08713013
24 PER48        AC -1.98056853
25 PER52        SC  2.35012436
26 PER52        SH -2.19384500
27 PER52        AC  1.38686223

 > str(data)
'data.frame':	27 obs. of  3 variables:
  $ Ind      : Factor w/ 9 levels "PER14","PER25",..: 1 1 1
2 2 2 3 3
3 4 ...
  $ Treatment: Factor w/ 3 levels "AC","SC","SH":
2 3 1 2 3 1 2 3 1
2 ...
  $ PC1      : num  1.14 1.45 2.45 1.24 4.55 ...

PC1 is my response variable, and Treatment is my factor with three
levels.  Each  of the nine individuals (Ind) in the study was tested
for all three factor levels, so I want to run the model with Ind
nested in Treatment.  I think that I want to set up the model like this:

 > m1<-aov(PC1~Treatment/Ind))

but I get the following error with anova(m1), and am not sure why I
get zero for all the residuals.