# [R] Nested design with aov

Marcelo Martinez Palao marmp at fcu.um.es
Sat Mar 4 13:19:46 CET 2000

```Hello,

I want to do this model:

Y_ml=Mu+M+L(M)+Error

M is a fixed factor with two levels, 1 and 2
L is a random factor and nested in M, with 9 levels (9 places inside
each level of M)

amarc is the dependent variable (animal abundance)

datos is the matrix

I used the next orders in R, but there is a problem with the Df
calculation:

> m
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2
2
2 2 2
[39] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> l
[1]  1  1  1  2  2  2  3  3  3  4  4  4  5  5  5  6  6  6  7  7  7  8
8
8  9
[26]  9  9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16
16
17 17
[51] 17 18 18 18
> amarc
[1]  4  9  1  2  1  2  9  6 15  8 10  8 10  7  3  2  1  1  2  1  1  1
4
3  2
[26]  0  2  4  0  1  0  0  0  1  1  0  4  4  4  3  0  1  0  1  0  1  0
1
0  0
[51]  3  1  0  1
> summary(aov(amarc~m+l%in%m,datos))
Df                    Sum Sq Mean Sq  F value
Pr(>F)
m                1                        130.67  130.67
15.6088    0.0002401 ***
m:l              1                        19.65   19.65
2.3478     0.1316381
Residuals   51                      426.94    8.37
---
Signif. codes:  0  `***'  0.001  `**'  0.01  `*'  0.05  `.'  0.1  ` '  1

I think that the correct calculation of Df is: (Underwood, 1997.
Experiments in Ecology: their logical design and interpretation using
analysis of variance. Cambridge University Press.)

Df
m                  1
m:l               16
Residuals     36

Where is the problem?
Why Df are differents?
How can I do this model?

Thaks for all.

Marcelo.

-------------- next part --------------
An embedded message was scrubbed...
From: Jan Krupa <krupa at alpha.sggw.waw.pl>
Subject: [R] archive of the mailing list?
Date: Mon, 8 Nov 1999 16:51:53 +0100 (EET)
Size: 1697
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20000304/c8d0d4c9/attachment.mht
```