[R] How to code the factor for ANOVA
Jinsong Zhao
jszhao at yeah.net
Mon Jun 26 07:05:17 CEST 2017
Hi there,
I have a experimental design related question. I have done a experiment
with 3 factors. The design matrix is similar to:
> data.frame(Factor.1 = rep(rep(0:2, each = 3),3), Factor.2 =
rep(c("U","S","N"), 9), Factor.3 = rep(0:2, each = 9))
Factor.1 Factor.2 Factor.3
1 0 U 0
2 0 S 0
3 0 N 0
4 1 U 0
5 1 S 0
6 1 N 0
7 2 U 0
8 2 S 0
9 2 N 0
10 0 U 1
11 0 S 1
12 0 N 1
13 1 U 1
14 1 S 1
15 1 N 1
16 2 U 1
17 2 S 1
18 2 N 1
19 0 U 2
20 0 S 2
21 0 N 2
22 1 U 2
23 1 S 2
24 1 N 2
25 2 U 2
26 2 S 2
27 2 N 2
The Factor.2 indicates the type of a fertilizer, such as urea, and the
Factor.3 indicates the weight of the fertilizer. So the treatments with
Factor.3 == 0 at each levels of Factor.1 are same. That means No.1, No.2
and No.3 are same, No.4, No.5 and No.6 are same, and No.7, No.8 and No.9
are same. Thus, in the real experiment, those treatments were not
performed as stated in the design matrix. For instance, only No.1, No.5
and No.9 are performed.
In the case, how to code the factor for ANOVA? I really appreciate any
comments and suggestions. Thanks in advance.
Best regards,
Jinsong
More information about the R-help
mailing list