Q 6.8

# Null Hypothesis(H0): (alpha)_i = 0 for all i
# Alternate Hypothesis(Ha): (alpha)_i != 0 for some i

# Null Hypothesis(H0): (beta)_j = 0 for all j
# Alternate Hypothesis(Ha): (beta)_j != 0 for some j

# Null Hypothesis(H0): (alpha)_i*(beta)_j = 0 for all i,j
# Alternate Hypothesis(Ha): (alpha)_i*(beta)_j != 0 for some i,j

r<- c(21,22,25,26,23,28,24,25,20,26,29,27,37,39,31,34,38,38,29,33,35,36,30,35)
t <- rep(c(-1,1,-1,1),6)
m<- rep(c(-1,-1,1,1),6)
mod <- aov(r~t*m)
summary(mod)
##             Df Sum Sq Mean Sq F value Pr(>F)
## t            1   30.4   30.37   0.806  0.380
## m            1    9.4    9.38   0.249  0.623
## t:m          1    0.4    0.37   0.010  0.922
## Residuals   20  753.5   37.67
mod <- aov(r~t+m)
summary(mod)
##             Df Sum Sq Mean Sq F value Pr(>F)
## t            1   30.4   30.37   0.846  0.368
## m            1    9.4    9.38   0.261  0.615
## Residuals   21  753.9   35.90
plot(mod)

## hat values (leverages) are all = 0.125
##  and there are no factor predictors; no plot no. 5

p-value of interaction is greater than the value of alpha(0.05). we fail to reject the Null Hypothesis.

As p-values of t,m are greater than the value of alpha(0.05). we conclude that the factors are insignificant. we fail to reject the Null Hypothesis.

From the plot of the residuals, we can conclude that our data has unequal variance & Normal Probability plot, we can conclude that our data follows Normal Distribution.

From the plot, we conclude that assumption of model adequacy is violated.

Q 6.12

# Null Hypothesis(H0): (alpha)_i = 0 for all i
# Alternate Hypothesis(Ha): (alpha)_i != 0 for some i

# Null Hypothesis(H0): (beta)_j = 0 for all j
# Alternate Hypothesis(Ha): (beta)_j != 0 for some j

# Null Hypothesis(H0): (alpha)_i*(beta)_j = 0 for all i,j
# Alternate Hypothesis(Ha): (alpha)_i*(beta)_j != 0 for some i,j

# a)
observations <- c(14.037,13.880,14.821,14.888,16.165,13.860,14.757,14.921,13.972,14.032,14.843,14.415,13.907,13.914,14.878,14.932)
x <- rep(c(-1,1,-1,1),4)
y <- rep(c(-1,-1,1,1),4)
experiment <- aov(observations~x+y+x*y)
summary(experiment)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## x            1  0.403  0.4026   1.262 0.2833  
## y            1  1.374  1.3736   4.305 0.0602 .
## x:y          1  0.317  0.3170   0.994 0.3386  
## Residuals   12  3.828  0.3190                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(experiment)
## (Intercept)           x           y         x:y 
##   14.513875   -0.158625    0.293000    0.140750
xyexperiment <- aov(observations~x+y)
summary(xyexperiment)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## x            1  0.403  0.4026   1.263 0.2815  
## y            1  1.374  1.3736   4.308 0.0584 .
## Residuals   13  4.145  0.3189                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(experiment)

## hat values (leverages) are all = 0.25
##  and there are no factor predictors; no plot no. 5

As p-value of interaction term is greater than the value of alpha(0.05). we fail to reject the Null Hypothesis.

As p-value of factors(x,y) are greater than the value of alpha(0.05). we fail to reject the Null Hypothesis. From this analysis we can conclude that no factor is significant.

From the plot of the residuals, we can conclude that our data has unequal variance & for the Normal Probability plot, we can conclude that our data follows Normal Distribution, for the plot, we conclude that there is an outlier(5) present.

One possibility of outlier can be due to wrongly entered reading. This can be corrected by performing the experiment once more and noting down the readings correctly.

Q 6.21

# Null Hypothesis(H0): (alpha)_i = 0 for all i
# Alternate Hypothesis(Ha): (alpha)_i != 0 for some i

# Null Hypothesis(H0): (beta)_j = 0 for all j
# Alternate Hypothesis(Ha): (beta)_j != 0 for some j

# Null Hypothesis(H0): (gamma)_k = 0 for all k
# Alternate Hypothesis(Ha): (gamma)_k != 0 for some k

# Null Hypothesis(H0): (delta)_l = 0 for all l
# Alternate Hypothesis(Ha): (delta)_l != 0 for some l


l <- rep(c(-1,1,-1,1),28)
t <- rep(c(-1,-1,1,1),28)
x <- rep(c(-1,-1,-1,-1,1,1,1,1),14)
s <- rep(c(rep(-1,8),rep(1,8)),7)
r <- c(10.0,0.0,4.0,0.0,0.0,5.0,6.5,16.5,4.5,19.5,15.0,41.5,8.0,21.5,0.0,18.0,
              18.0,16.5,6.0,10.0,0.0,20.5,18.5,4.5,18.0,18.0,16.0,39.0,4.5,10.5,0.0,5.0,
              14.0,4.5,1.0,34.0,18.5,18.0,7.5,0.0,14.5,16.0,8.5,6.5,6.5,6.5,0.0,7.0,
              12.5,17.5,14.5,11.0,19.5,20.0,6.0,23.5,10.0,5.5,0.0,3.5,10.0,0.0,4.5,10.0,
              19.0,20.5,12.0,25.5,16.0,29.5,0.0,8.0,0.0,10.0,0.5,7.0,13.0,15.5,1.0,32.5,
              16.0,17.5,14.0,21.5,15.0,19.0,10.0,8.0,17.5,7.0,9.0,8.5,41.0,24.0,4.0,18.5,
              18.5,33.0,5.0,0.0,11.0,10.0,0.0,8.0,6.0,36.0,3.0,36.0,14.0,16.0,6.5,8.0)
model <- aov(r~l*t*x*s)
summary(model)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## l            1    917   917.1  10.588 0.00157 **
## t            1    388   388.1   4.481 0.03686 * 
## x            1    145   145.1   1.676 0.19862   
## s            1      1     1.4   0.016 0.89928   
## l:t          1    219   218.7   2.525 0.11538   
## l:x          1     12    11.9   0.137 0.71178   
## t:x          1    115   115.0   1.328 0.25205   
## l:s          1     94    93.8   1.083 0.30066   
## t:s          1     56    56.4   0.651 0.42159   
## x:s          1      2     1.6   0.019 0.89127   
## l:t:x        1      7     7.3   0.084 0.77294   
## l:t:s        1    113   113.0   1.305 0.25623   
## l:x:s        1     39    39.5   0.456 0.50121   
## t:x:s        1     34    33.8   0.390 0.53386   
## l:t:x:s      1     96    95.6   1.104 0.29599   
## Residuals   96   8316    86.6                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)

## hat values (leverages) are all = 0.1428571
##  and there are no factor predictors; no plot no. 5

Assume alpha equal to 0.05

As p-value of l(0.00157) and type(0.03686) are less than the value of alpha(0.05). we conclude that the factors l and t significantly affect putting performance.

From the Residuals plot, we can conclude that our data has unequal variance & Normal Probability plot, we can conclude that our data follows Normal Distribution.

From the plots, we can conclude that there is an indication of model inadequacy.

Q 6.36

# Null Hypothesis(H0): (alpha)_i = 0 for all i
# Alternate Hypothesis(Ha): (alpha)_i != 0 for some i

# Null Hypothesis(H0): (beta)_j = 0 for all j
# Alternate Hypothesis(Ha): (beta)_j != 0 for some j

# Null Hypothesis(H0): (gamma)_k = 0 for all k
# Alternate Hypothesis(Ha): (gamma)_k != 0 for some k

# Null Hypothesis(H0): (delta)_l = 0 for all l
# Alternate Hypothesis(Ha): (delta)_l != 0 for some l

A <- rep(c(-1,1,-1,1),4)
B <- rep(c(-1,-1,1,1),4)
C <- rep(c(-1,-1,-1,-1,1,1,1,1),2)
D <- c(rep(-1,8),rep(1,8))
resistivity <- c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.60,11.73,1.16,4.68,2.16,9.11,1.07,5.30)
library(DoE.base)
## Loading required package: grid
## Loading required package: conf.design
## Registered S3 method overwritten by 'DoE.base':
##   method           from       
##   factorize.factor conf.design
## 
## Attaching package: 'DoE.base'
## The following objects are masked from 'package:stats':
## 
##     aov, lm
## The following object is masked from 'package:graphics':
## 
##     plot.design
## The following object is masked from 'package:base':
## 
##     lengths
model <- aov(resistivity~A*B*C*D) 
summary(model)
##             Df Sum Sq Mean Sq
## A            1 159.83  159.83
## B            1  36.09   36.09
## C            1   0.78    0.78
## D            1   0.10    0.10
## A:B          1  18.30   18.30
## A:C          1   1.42    1.42
## B:C          1   0.84    0.84
## A:D          1   0.05    0.05
## B:D          1   0.04    0.04
## C:D          1   0.01    0.01
## A:B:C        1   1.90    1.90
## A:B:D        1   0.15    0.15
## A:C:D        1   0.00    0.00
## B:C:D        1   0.14    0.14
## A:B:C:D      1   0.32    0.32
coef(model)
## (Intercept)           A           B           C           D         A:B 
##    4.680625    3.160625   -1.501875   -0.220625   -0.079375   -1.069375 
##         A:C         B:C         A:D         B:D         C:D       A:B:C 
##   -0.298125    0.229375   -0.056875   -0.046875    0.029375    0.344375 
##       A:B:D       A:C:D       B:C:D     A:B:C:D 
##   -0.096875   -0.010625    0.094375    0.141875
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B   A:B:C

model1 <- aov(resistivity~A+B+C+A*B+A*B*C)
summary(model1)
##             Df Sum Sq Mean Sq  F value   Pr(>F)    
## A            1 159.83  159.83 1563.061 1.84e-10 ***
## B            1  36.09   36.09  352.937 6.66e-08 ***
## C            1   0.78    0.78    7.616  0.02468 *  
## A:B          1  18.30   18.30  178.933 9.33e-07 ***
## A:C          1   1.42    1.42   13.907  0.00579 ** 
## B:C          1   0.84    0.84    8.232  0.02085 *  
## A:B:C        1   1.90    1.90   18.556  0.00259 ** 
## Residuals    8   0.82    0.10                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model1)

## hat values (leverages) are all = 0.5
##  and there are no factor predictors; no plot no. 5

trans<- log(resistivity)
trans_model <- aov(trans~A*B*C*D)
summary(trans_model)
##             Df Sum Sq Mean Sq
## A            1 10.572  10.572
## B            1  1.580   1.580
## C            1  0.001   0.001
## D            1  0.005   0.005
## A:B          1  0.010   0.010
## A:C          1  0.025   0.025
## B:C          1  0.000   0.000
## A:D          1  0.001   0.001
## B:D          1  0.000   0.000
## C:D          1  0.005   0.005
## A:B:C        1  0.064   0.064
## A:B:D        1  0.014   0.014
## A:C:D        1  0.000   0.000
## B:C:D        1  0.000   0.000
## A:B:C:D      1  0.016   0.016
halfnormal(trans_model)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B:C

trans_model1 <- aov(trans~A+B+C+A*B*C)
summary(trans_model1)
##             Df Sum Sq Mean Sq  F value   Pr(>F)    
## A            1 10.572  10.572 1994.556 6.98e-11 ***
## B            1  1.580   1.580  298.147 1.29e-07 ***
## C            1  0.001   0.001    0.124  0.73386    
## A:B          1  0.010   0.010    1.839  0.21207    
## A:C          1  0.025   0.025    4.763  0.06063 .  
## B:C          1  0.000   0.000    0.054  0.82223    
## A:B:C        1  0.064   0.064   12.147  0.00826 ** 
## Residuals    8  0.042   0.005                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(trans_model1)

## hat values (leverages) are all = 0.5
##  and there are no factor predictors; no plot no. 5

From half normal plot, we can conclude that the factors A,B,AB,ABC has significant effects. As this model is significant, p-values of A,B,c,AB,ABC are less than the value of alpha(0.05)

From the Residuals plot, we can conclude that our data has unequal variance & Probability plot our data follows approximately Normal Distribution.

From the plots, we can conclude that there is an indication of model inadequacy.

From the plot, we conclude that the factors A,B,C,ABC has significant effect

From the Residuals plot, we can conclude that our data has unequal variance.

From the Normal Probability plot, we can conclude that our data follows approximately Normal Distribution.

From the plots, we can conclude that there is an indication of model inadequacy.

There is an improvement in the variance of the data. it is not sufficient to conclude that our data has equal variance. before transformation was done interactions AB, AC, B*C and factor C are significant. After transformation they are insignificant.

Q 6.39

library(DoE.base)
A <- rep(c(-1,1),16)
B <- rep(c(-1,-1,1,1),8)
C <- rep(c(rep(-1,4),rep(1,4)),4)
D <- rep(c(rep(-1,8),rep(1,8)),2)
E <- c(rep(-1,16),rep(1,16))
data1<-data.frame(A,B,C,D,E)
observation<-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)
m1<-aov(observation~A*B*C*D*E,data = data1)
halfnormal(m1)
## 
## Significant effects (alpha=0.05, Lenth method):
##  [1] D     E     A:D   A     D:E   B:E   A:B   A:B:E A:E   A:D:E

m2<-aov(observation~A*B*D*E)
summary(m2)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## A            1  83.56   83.56  57.233 1.14e-06 ***
## B            1   0.06    0.06   0.041 0.841418    
## D            1 285.78  285.78 195.742 2.16e-10 ***
## E            1 153.17  153.17 104.910 1.97e-08 ***
## A:B          1  48.93   48.93  33.514 2.77e-05 ***
## A:D          1  88.88   88.88  60.875 7.66e-07 ***
## B:D          1   0.01    0.01   0.004 0.950618    
## A:E          1  33.76   33.76  23.126 0.000193 ***
## B:E          1  52.71   52.71  36.103 1.82e-05 ***
## D:E          1  61.80   61.80  42.328 7.24e-06 ***
## A:B:D        1   3.82    3.82   2.613 0.125501    
## A:B:E        1  44.96   44.96  30.794 4.40e-05 ***
## A:D:E        1  26.01   26.01  17.815 0.000650 ***
## B:D:E        1   0.05    0.05   0.035 0.854935    
## A:B:D:E      1   5.31    5.31   3.634 0.074735 .  
## Residuals   16  23.36    1.46                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(m2)
## (Intercept)           A           B           D           E         A:B 
##  10.1803125   1.6159375   0.0434375   2.9884375   2.1878125   1.2365625 
##         A:D         B:D         A:E         B:E         D:E       A:B:D 
##   1.6665625  -0.0134375   1.0271875   1.2834375   1.3896875  -0.3453125 
##       A:B:E       A:D:E       B:D:E     A:B:D:E 
##   1.1853125   0.9015625  -0.0396875   0.4071875
plot(m2)

## hat values (leverages) are all = 0.5
##  and there are no factor predictors; no plot no. 5

From the half normal plot, we can conclude that the Factors A,B,D,E and their interactions AB,AD,AE,DE,BE,ABE,AD*E have significant effects.

Normality assumption is satisfied

##Difference between them is 2ˆ5 Factorial Design and 2ˆ4 Factorial Design.