## Hw Week 11
## Problem 6.8
CM<-c(rep(1,6),rep(2,6))
Time<-c(rep(12,12),rep(18,12))
obs<-c(21,23,20,22,28,26,25,24,29,26,25,27,37,38,35,39,38,36,31,29,30,34,33,35)
data.frame(CM,Time,obs)
## CM Time obs
## 1 1 12 21
## 2 1 12 23
## 3 1 12 20
## 4 1 12 22
## 5 1 12 28
## 6 1 12 26
## 7 2 12 25
## 8 2 12 24
## 9 2 12 29
## 10 2 12 26
## 11 2 12 25
## 12 2 12 27
## 13 1 18 37
## 14 1 18 38
## 15 1 18 35
## 16 1 18 39
## 17 1 18 38
## 18 1 18 36
## 19 2 18 31
## 20 2 18 29
## 21 2 18 30
## 22 2 18 34
## 23 2 18 33
## 24 2 18 35
dat<-data.frame(CM,Time,obs)
model<-lm(obs~CM*Time,data=dat)
coef(model)
## (Intercept) CM Time CM:Time
## -22.666667 18.333333 3.611111 -1.305556
## halfnormal(model)
## plot(model)
summary(model)
##
## Call:
## lm(formula = obs ~ CM * Time, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.333 -1.500 -0.250 1.208 4.667
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -22.6667 7.4391 -3.047 0.006365 **
## CM 18.3333 4.7049 3.897 0.000896 ***
## Time 3.6111 0.4863 7.426 3.61e-07 ***
## CM:Time -1.3056 0.3076 -4.245 0.000397 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.26 on 20 degrees of freedom
## Multiple R-squared: 0.8713, Adjusted R-squared: 0.852
## F-statistic: 45.12 on 3 and 20 DF, p-value: 4.346e-09
interaction.plot(dat$CM,dat$Time,dat$obs)

## > coef(model)
## (Intercept) CM Time CM:Time
## -22.666667 18.333333 3.611111 -1.305556
## Residuals:
## Min 1Q Median 3Q Max
## -3.333 -1.500 -0.250 1.208 4.667
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -22.6667 7.4391 -3.047 0.006365 **
## CM 18.3333 4.7049 3.897 0.000896 ***
## Time 3.6111 0.4863 7.426 3.61e-07 ***
## CM:Time -1.3056 0.3076 -4.245 0.000397 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Residual standard error: 2.26 on 20 degrees of freedom
## Multiple R-squared: 0.8713, Adjusted R-squared: 0.852
## F-statistic: 45.12 on 3 and 20 DF, p-value: 4.346e-09
## Comments:
## Model is significant p value is less than 0.05
## Factors Time and (Culture Medium: Time) interaction are significant
## The variance is slightly unequal as shown plots in the plot of residuals.
## The F value of F = 45.12 indicates that the model is significant
## Growth rate is affected by factor Time and the CM:Time interaction.