Two Factor-Factorial Design of Experiment - R Program
Factorial design is an important experimental design whose design consist of two or more factors.
This design is most used to examined treatment variations and can combined a series of into one, for efficiency.
The simplest type of factorial design is The Two Factor Factorial Design. In these two levels of factorial design
have level of factor A, and level of factor B, then each replication contains all ab treatment combinations.
Written by: Pawani Liyanaarachchi ,BSc (Hons) in Applied science (statistics), University of Sri Jayewardenepura
Consider yijk be the observed response when factor A is at the ith level (i=1,2,...,a) and factor B is at the
jth level (j=1,2,...,b) for the kth replicate (k=1,2,...,n)
In this tutorial, we will study followings.
- What is Replication?
- Design Block for the Two Factor Factorial Design
- Statistical model for Two Factor Factorial Design
- Hypothesis Testing for Two Factor Factorial Design
- Example problem for Randomized Complete Block Design
What is Replication?
The mean of replication is an independent repeat of each combination. Replication has two important properties. They are,
- Replication allows the experimenter to estimate of experimental error.
- If the sample mean used to estimate the true mean response for one of the factor levels, replication permits
the experimenter to obtain a more precise estimate of this parameter.
Design Block for the Two Factor Factorial Design
Statistical model for Two Factor Factorial Design
Yijk = µ + τi + βj + (τβ)ij + εijk
where,
- i=1,2,...,a
- j=1,2,...,b
- k=1,2,...,n
- Yijk: observation for ith level of factor A, jth level of factor B for
the kth replicate
- µ: overall mean
- τi: effect of ith level of factor A
- βj: effect oh jth level of factor B
- (τβ)ij: effect of interaction between τi and βj
- εijk: random error
Notations for Anova Table
Partitioning the SS
The total corrected sum of squares can be written as:
SST = SSA +SSB + SSAB + SSE
Hypothesis Testing for Two Factor Factorial Design
When we are doing hypothesis testing in this design we have to consider about row, column, and interaction effect also.
There we consider 3 hypotheses in this two-factorial design.
- H0 : τ1 = τ2 = ... = τa = 0 vs H1 : at least one
Ti ≠ 0
- H0 : β1 = β2 = ... = βb = 0 vs H1 : at least one
βj ≠ 0
- H0 : (τβ)ij = 0 for all i,j vs H1 : at least one (τβ)ij ≠ 0
ANOVA table
ANOVA - Computing Formulas
This sum of squares also contains SSA and SSB. Therefore, the second step is to compute SSAB as,
SSAB = SSSubtotal - SSA - SSB
The Total sum of squares
Total error sum of squares
SSE = SST - SSA - SSB - SSAB or
SSE = SST - SSSubtotal
Example problem for Two Factor Factorial Design Experiment
A university student who studies an engineering faculty tests 3 types of fertilizers (A,B,C) for a new plant at 3 soil types
(1,2,3). Four plants are tested at each combination of fertilizer type and soil type, and all 36 tests are run in
random order. He wants to find out what effects do fertilizer type and soil type have on the growth of a plant.
According to the above theoretical model and also using R code (in R studio platform) we can solve this problem.
R Program for Two Factor Factorial Design Experiment
Download R Program for Two Factor Factorial Design of Experiment
## setup framework for 2 factors and response variable
fertilizer<- as.factor(rep(1:3, each=12))
soil_type <- as.factor(rep(c(1,2,3), each=4, times = 3))
growth <- c(130, 155, 74, 180, 34, 40, 80, 75, 20, 70, 82, 58,
150, 188, 159, 126, 136, 122, 106, 115, 25, 70, 58, 45,
138, 110, 168, 160, 174, 120, 150, 139, 96, 104, 82, 60)
y<- data.frame(fertilizer,soil_type,growth)
## apply a linear model
yfit <- lm(growth ~ fertilizer+soil_type+fertilizer*soil_type, y)
## compute the analysis of variance table
anova(yfit)
Results of after running two factor factorial design experiment anova table