[R] Nested ANOVA residuals error
Daniel Malter
daniel at umd.edu
Thu Jul 16 22:18:07 CEST 2009
It is because the nesting structure perfectly explains the data (i.e., there
is only one observation and, therefore, no variation for each Ind in each
Treatment).
e=rnorm(90,0,1)
x=rep(1:3,30)
y=rep(1:30,each=3)
z=x+y+e
ano=aov(z~factor(y)/factor(x))
ano
residuals(ano)
Best,
Daniel
-------------------------
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 Jeff DaCosta
Gesendet: Thursday, July 16, 2009 3:37 PM
An: r-help at r-project.org
Betreff: [R] Nested ANOVA residuals error
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.
> anova(m1)
Analysis of Variance Table
Response: PC1
Df Sum Sq Mean Sq F value Pr(>F)
Treatment 2 9.215 4.607
Treatment:Ind 24 142.140 5.923
Residuals 0 0.000
Warning message:
In anova.lm(m1) :
ANOVA F-tests on an essentially perfect fit are unreliable
Any input would be appreciated, thanks for your time and consideration.
-Jeff
[[alternative HTML version deleted]]
______________________________________________
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.
More information about the R-help
mailing list