Time <- c(rep(-1,6),rep(1,6),rep(-1,6),rep(1,6))
Medium <- c(rep(-1,6),rep(-1,6),rep(1,6),rep(1,6))
obs8 <- c(21,22,23,28,20,26,25,26,24,25,29,27,37,39,38,38,35,36,31,34,29,33,30,35)
dat8 <- data.frame(Time,Medium,obs8)
model8 <- lm(obs8~Time*Medium, data = dat8)
coef(model8)
## (Intercept) Time Medium Time:Medium
## 29.625000 -0.625000 4.958333 -1.958333
halfnormal(model8)
## Warning in halfnormal.lm(model8): halfnormal not recommended for models with
## more residual df than model df
##
## Significant effects (alpha=0.05, Lenth method):
## [1] Medium Time:Medium e8
interaction.plot(Medium,Time,obs8)
anova(model8)
plot(model8)
## hat values (leverages) are all = 0.1666667
## and there are no factor predictors; no plot no. 5
Arsenic <- c(rep(-1,4),rep(1,4),rep(-1,4),rep(1,4))
Deposition <- c(rep(-1,4),rep(-1,4),rep(1,4),rep(1,4))
Thickness <- c(14.037,16.165,13.972,13.907,13.880,13.860,14.032,13.914,14.821,14.757,14.843,14.878,14.888,14.921,14.415,14.932)
dat12 <- data.frame(Arsenic,Deposition,Thickness)
model12 <- lm(Thickness~Arsenic*Deposition, data = dat12)
coef(model12)
## (Intercept) Arsenic Deposition Arsenic:Deposition
## 14.513875 -0.158625 0.293000 0.140750
anova(model12)
\[ y (Thickness)=14.513875-0.158625(A)+0.293(B)+0.14075(AB)+Error \]
plot(model12)
## hat values (leverages) are all = 0.25
## and there are no factor predictors; no plot no. 5
Length <- c(rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7))
Type <- c(rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7))
Break <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))
Slope <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))
Distance <- c(10,18,14,12.5,19,16,18.5,
0,16.5,4.5,17.5,20.5,17.5,33,
4,6,1,14.5,12,14,5,
0,10,34,11,25.5,21.5,0,
0,0,18.5,19.5,16,15,11,
5,20.5,18,20,29.5,19,10,
6.5,18.5,7.5,6,0,10,0,
16.5,4.5,0,23.5,8,8,8,
4.5,18,14.5,10,0,17.5,6,
19.5,18,16,5.5,10,7,36,
15,16,8.5,0,0.5,9,3,
41.5,39,6.5,3.5,7,8.5,36,
8,4.5,6.5,10,13,41,14,
21.5,10.5,6.5,0,15.5,24,16,
0,0,0,4.5,1,4,6.5,
18,5,7,10,32.5,18.5,8)
dat21 <- data.frame(Length,Type,Break,Slope,Distance)
model21 <- lm(Distance~Length*Type*Break*Slope, data = dat21)
halfnormal(model21)
## Warning in halfnormal.lm(model21): halfnormal not recommended for models with
## more residual df than model df
##
## Significant effects (alpha=0.05, Lenth method):
## [1] Length e95 e28 e44 e49 Type e84 e32 e78
anova(model21)
plot(model21)
## hat values (leverages) are all = 0.1428571
## and there are no factor predictors; no plot no. 5
model21s <- lm(Distance~Length*Type, data = dat21)
plot(model21s)
## hat values (leverages) are all = 0.03571429
## and there are no factor predictors; no plot no. 5
A36 <- c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B36 <- c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1)
C36 <- c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1)
D36 <- c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
obs36 <- c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.6,11.73,1.16,4.68,2.16,9.11,1.07,5.30)
dat36 <- data.frame(A36,B36,C36,D36,obs36)
model36 <- lm(obs36~A36*B36*C36*D36,data = dat36)
coef(model36)
## (Intercept) A36 B36 C36 D36
## 4.680625 3.160625 -1.501875 -0.220625 -0.079375
## A36:B36 A36:C36 B36:C36 A36:D36 B36:D36
## -1.069375 -0.298125 0.229375 -0.056875 -0.046875
## C36:D36 A36:B36:C36 A36:B36:D36 A36:C36:D36 B36:C36:D36
## 0.029375 0.344375 -0.096875 -0.010625 0.094375
## A36:B36:C36:D36
## 0.141875
halfnormal(model36)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A36 B36 A36:B36 A36:B36:C36
model36n <- lm(obs36~A36*B36,data = dat36)
anova(model36n)
plot(model36n)
## hat values (leverages) are all = 0.25
## and there are no factor predictors; no plot no. 5
OBS36 <- log(obs36)
MODEL36 <- lm(OBS36~A36*B36*C36*D36)
coef(MODEL36)
## (Intercept) A36 B36 C36 D36
## 1.185417116 0.812870345 -0.314277554 -0.006408558 -0.018077390
## A36:B36 A36:C36 B36:C36 A36:D36 B36:D36
## -0.024684570 -0.039723700 -0.004225796 -0.009578245 0.003708723
## C36:D36 A36:B36:C36 A36:B36:D36 A36:C36:D36 B36:C36:D36
## 0.017780432 0.063434408 -0.029875960 -0.003740235 0.003765760
## A36:B36:C36:D36
## 0.031322043
halfnormal(MODEL36)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A36 B36 A36:B36:C36
ModeL36n <- lm(OBS36~A36*B36)
plot(ModeL36n)
## hat values (leverages) are all = 0.25
## and there are no factor predictors; no plot no. 5
anova(ModeL36n)
A39 <- c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B39 <- c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1)
C39 <- c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1)
D39 <- c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
E39 <- c(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
obs39 <- c(8.11,5.56,5.77,5.82,9.17,7.8,3.23,5.69,8.82,14.23,9.2,8.94,8.68,11.49,6.25,9.12,7.93,5,7.47,12,9.86,3.65,6.4,11.61,12.43,17.55,8.87,25.38,13.06,18.85,11.78,26.05)
dat39 <- data.frame(A39,B39,C39,D39,E39,obs39)
mod39 <- lm(obs39~A39*B39*C39*D39*E39,data=dat39)
coef(mod39)
## (Intercept) A39 B39 C39
## 10.1803125 1.6159375 0.0434375 -0.0121875
## D39 E39 A39:B39 A39:C39
## 2.9884375 2.1878125 1.2365625 -0.0015625
## B39:C39 A39:D39 B39:D39 C39:D39
## -0.1953125 1.6665625 -0.0134375 0.0034375
## A39:E39 B39:E39 C39:E39 D39:E39
## 1.0271875 1.2834375 0.3015625 1.3896875
## A39:B39:C39 A39:B39:D39 A39:C39:D39 B39:C39:D39
## 0.2503125 -0.3453125 -0.0634375 0.3053125
## A39:B39:E39 A39:C39:E39 B39:C39:E39 A39:D39:E39
## 1.1853125 -0.2590625 0.1709375 0.9015625
## B39:D39:E39 C39:D39:E39 A39:B39:C39:D39 A39:B39:C39:E39
## -0.0396875 0.3959375 -0.0740625 -0.1846875
## A39:B39:D39:E39 A39:C39:D39:E39 B39:C39:D39:E39 A39:B39:C39:D39:E39
## 0.4071875 0.1278125 -0.0746875 -0.3553125
halfnormal(mod39)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] D39 E39 A39:D39 A39 D39:E39 B39:E39
##
## [7] A39:B39 A39:B39:E39 A39:E39 A39:D39:E39
model39 <- lm(obs39~A39*B39*D39*E39,data = dat39)
plot(model39)
## hat values (leverages) are all = 0.5
## and there are no factor predictors; no plot no. 5
halfnormal(model39)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] D39 E39 A39:D39 A39 D39:E39 B39:E39
##
## [7] A39:B39 A39:B39:E39 A39:E39 A39:D39:E39 e10
anova(model39)