This report captures work done for the 11th flipped assignment, studying the effects of Randomized Complete Block Design.
Setting things up:
# setup Libraries
library(knitr)
library(dplyr)
library(tidyr)
library(GAD)
# READ IN FILE
setwd("D:/R Files/")
dat <- read.csv("chemicals.csv",header=TRUE)
# PIVOT COLUMNS
dat <- pivot_longer(dat,c(Bolt1,Bolt2,Bolt3,Bolt4,Bolt5))
# SET UP VARIABLES
solution <- as.fixed(dat$Chemical)
days <- as.random(dat$name)
obs <- as.integer(dat$value)
My_Factor <- solution
My_Response <- obs
My_Factor_Name = "Chemical"
My_Response_Name = "Strength"
We are studying the effect of the four chemical agents on the strength of a particular type of cloth. And, because there might be variability from one bolt to another, the chemist decided to use a randomized block design, with the bolts of cloth considered as blocks.
The Linear Effects for this Model are:
\(\quad y_{ij}\) = \(\mu\) + \(\tau_i\) + \(\beta_j\) + \(\epsilon_{ij}\)
Where:
\(\tau_i\) is the effect of the \(\ i^{th}\) treatment of chemical agent used
\(\beta_j\) is the effect of the \(\ j^{th}\) block of cloth bolt used, and
\(\epsilon_{ij}\) is the random error term.
The Hypotheses we will test are:
\(\quad H_0\) : \(\tau_i\) = 0 \(\forall\) i
\(\quad H_a\) : \(\tau_i \neq\) 0for at least one \(\ i\)
\(\quad\)at a significance level of \(\alpha\) = 0.15
By running a General ANOVA Design on the linear model of chemical agents and cloth bolts, we get the following results:
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## solution 3 12.95 4.317 2.3761 0.1211
## days 4 157.00 39.250 21.6055 2.059e-05 ***
## Residual 12 21.80 1.817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With a p-value of 0.1211 and a significance level of 0.15, we reject the Null hypothesis. There is enough evidence to support the claim of a significant effect of the chemical agent used.
We now assume that the researcher did not block on Bolt, but rather ran the experiment at a completely randomized design on random pieces of cloth. In this case we will run a one-way ANOVA.
The Linear Effects for this Model are:
\(\quad y_{ij}\) = \(\mu\) + \(\tau_i\) + \(\epsilon_{ij}\)
Where:
\(\tau_i\) is the effect of the \(\ i^{th}\) treatment of chemical agent used
\(\epsilon_{ij}\) is the random error term.
The Hypotheses we will test are:
\(\quad H_0\) : \(\tau_i\) = 0 \(\forall\) i
\(\quad H_a\) : \(\tau_i \neq\) 0 for at least one \(\ i\)
\(\quad\)at a significance level of \(\alpha\) = 0.15
By running a one-way ANOVA Design on the linear model of chemical agents and we get the following results:
## Df Sum Sq Mean Sq F value Pr(>F)
## My_ANOVA_Input_Table[[1]] 3 12.95 4.317 0.386 0.764
## Residuals 16 178.80 11.175
With a p-value of 0.764 and a significance level of 0.15, we fail to reject the Null hypothesis. There is not enough evidence to support the claim of a significant effect of the chemical agent used.
The differences between the blocked design and the non-blocked was startling, the blocked having a p-value of 0.12 with the non-blocked having a a p-value of 0.76. This clearly shows that the block (bolt type) represents a significant amount of nuisance variablity.