More Related Content
Similar to Presentation2 (20)
Presentation2
- 6. Operator=as.factor(c(rep("Operator 1", 4), rep("Operator 2", 4), rep("Operator 3", 4), rep("Operator 4", 4))) ####
COLUMN EFFECT ####
Order=as.factor(c(rep(1:4, 4)))
Method=as.factor(c("C", "B", "A", "D", "D", "C", "B", "A", "A", "D", "C", "B", "B", "A", "D", "C"))
Time=c(10, 7, 5, 10, 14, 18, 10, 10, 7, 11, 11, 12, 8, 8, 9, 14)
tv.data=data.frame(Operator, Order, Method, Time)
tv.data
#### SOME EXPLORATORY PLOTS ####
plot.design(tv.data, main="Generated by Plot Design")
boxplot(split(Time, Method), main="Observations vs Method")
boxplot(split(Time, Operator), main="Observations vs Operator")
boxplot(split(Time, Order), main="Observations vs Order of Assembly")
- 9. #### ANOVA ####
milk.aov=aov(Obs ~ Solution + Days, data=milk.data)
summary(milk.aov)
anova(milk.aov)
#### SOME PLOTS ####
par(mfrow=c(2,2))
plot(milk.aov)
#### Fisher LSD ####
y.bar<-tapply(Obs, Solution, mean)
MSE<-anova(milk.aov)$Mean[3]
(t_cr<-qt(0.025,6,lower.tail=F))
(t_12<-(y.bar[1] - y.bar[2])/sqrt(MSE*2/4))
(t_13<-(y.bar[1] - y.bar[3])/sqrt(MSE*2/4))
(t_23<-(y.bar[2] - y.bar[3])/sqrt(MSE*2/4))
# We reject H0 if |t| > t_cr
abs(t_12)>t_cr
abs(t_13)>t_cr
abs(t_23)>t_cr
# Or we can compute P-value:
2*pt(abs(t_12), 6,lower.tail=F)
2*pt(abs(t_13), 6,lower.tail=F)
2*pt(abs(t_23), 6,lower.tail=F)