problem 5.4

library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
depth<-rep(seq(1,4),9)
feedrate<-c(rep(1,12),rep(2,12),rep(3,12))
response<-c(74,79,82,99,64,68,88,104,60,73,92,96,92,98,99,104,86,104,108,110,88,88,95,99,99,104,108,114,98,99,110,111,102,95,99,107)
data.frame(depth,feedrate,response)
##    depth feedrate response
## 1      1        1       74
## 2      2        1       79
## 3      3        1       82
## 4      4        1       99
## 5      1        1       64
## 6      2        1       68
## 7      3        1       88
## 8      4        1      104
## 9      1        1       60
## 10     2        1       73
## 11     3        1       92
## 12     4        1       96
## 13     1        2       92
## 14     2        2       98
## 15     3        2       99
## 16     4        2      104
## 17     1        2       86
## 18     2        2      104
## 19     3        2      108
## 20     4        2      110
## 21     1        2       88
## 22     2        2       88
## 23     3        2       95
## 24     4        2       99
## 25     1        3       99
## 26     2        3      104
## 27     3        3      108
## 28     4        3      114
## 29     1        3       98
## 30     2        3       99
## 31     3        3      110
## 32     4        3      111
## 33     1        3      102
## 34     2        3       95
## 35     3        3       99
## 36     4        3      107
depth<-as.fixed(depth)
feedrate<-as.fixed(feedrate)
model<-aov(response~depth+feedrate+depth*feedrate)
gad(model) 
## Analysis of Variance Table
## 
## Response: response
##                Df  Sum Sq Mean Sq F value    Pr(>F)    
## depth           3 2125.11  708.37 24.6628 1.652e-07 ***
## feedrate        2 3160.50 1580.25 55.0184 1.086e-09 ***
## depth:feedrate  6  557.06   92.84  3.2324   0.01797 *  
## Residual       24  689.33   28.72                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)

feedrate1<-c(74,79,82,99,64,68,88,104,60,73,92,96)
mean(feedrate1)
## [1] 81.58333
feedrate2<-c(92,98,99,104,86,104,108,110,88,88,95,99)
mean(feedrate2)
## [1] 97.58333
feedrate3<-c(99,104,108,114,98,99,110,111,102,95,99,107)
mean(feedrate3)
## [1] 103.8333

p value for depth is 1.652e-07

p value for feedrate is 1.086e-09

p value for depth:feedrate is 0.01797

problem 5.34

library(GAD)
a<-c(rep(1,4),rep(2,4),rep(3,4),rep(1,4),rep(2,4),rep(3,4),rep(1,4),rep(2,4),rep(3,4))
a<-as.fixed(a)
data.frame(depth,feedrate,a,response)
##    depth feedrate a response
## 1      1        1 1       74
## 2      2        1 1       79
## 3      3        1 1       82
## 4      4        1 1       99
## 5      1        1 2       64
## 6      2        1 2       68
## 7      3        1 2       88
## 8      4        1 2      104
## 9      1        1 3       60
## 10     2        1 3       73
## 11     3        1 3       92
## 12     4        1 3       96
## 13     1        2 1       92
## 14     2        2 1       98
## 15     3        2 1       99
## 16     4        2 1      104
## 17     1        2 2       86
## 18     2        2 2      104
## 19     3        2 2      108
## 20     4        2 2      110
## 21     1        2 3       88
## 22     2        2 3       88
## 23     3        2 3       95
## 24     4        2 3       99
## 25     1        3 1       99
## 26     2        3 1      104
## 27     3        3 1      108
## 28     4        3 1      114
## 29     1        3 2       98
## 30     2        3 2       99
## 31     3        3 2      110
## 32     4        3 2      111
## 33     1        3 3      102
## 34     2        3 3       95
## 35     3        3 3       99
## 36     4        3 3      107
m1<-aov(response~depth+feedrate+a+depth*feedrate)
GAD::gad(m1)
## Analysis of Variance Table
## 
## Response: response
##                Df  Sum Sq Mean Sq F value    Pr(>F)    
## depth           3 2125.11  708.37 30.6373 4.893e-08 ***
## feedrate        2 3160.50 1580.25 68.3463 3.635e-10 ***
## a               2  180.67   90.33  3.9069  0.035322 *  
## depth:feedrate  6  557.06   92.84  4.0155  0.007258 ** 
## Residual       22  508.67   23.12                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(m1)

meansqerror<-90.33
meansqerror<-23.12
difference<-meansqerror-meansqerror
varience<-difference/(3*4)
varience
## [1] 0

From the variance estimation, we can conclude that there is a huge difference

In this experiment blocking was not useful.

Problem 13.5

library(GAD)
temperature<-rep(seq(1,3),6)
position<-c(rep(1,9),rep(2,9))
response<-c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)
data.frame(temperature,position,response)
##    temperature position response
## 1            1        1      570
## 2            2        1     1063
## 3            3        1      565
## 4            1        1      565
## 5            2        1     1080
## 6            3        1      510
## 7            1        1      583
## 8            2        1     1043
## 9            3        1      590
## 10           1        2      528
## 11           2        2      988
## 12           3        2      526
## 13           1        2      547
## 14           2        2     1026
## 15           3        2      538
## 16           1        2      521
## 17           2        2     1004
## 18           3        2      532
temperature<-as.fixed(temperature)
position<-as.random(position)
model<-aov(response~temperature+position+temperature*position)
GAD::gad(model) 
## Analysis of Variance Table
## 
## Response: response
##                      Df Sum Sq Mean Sq  F value    Pr(>F)    
## temperature           2 945342  472671 1155.518 0.0008647 ***
## position              1   7160    7160   15.998 0.0017624 ** 
## temperature:position  2    818     409    0.914 0.4271101    
## Residual             12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot( model)

## As p-value for temperature(0.0008647) and position(0.0017624) are less than the value of the alpha(0.05). Therefore, we reject the Null Hypothesis. ## From the plot, we can conclude that the variances are unequal and our data follows normal distribution

problem 13.6

library(GAD)
operator<-rep(c(rep(1,3), rep(2,3)), 10)
part<-c(rep(1,6),rep(2,6),rep(3,6),rep(4,6),rep(5,6),rep(6,6),rep(7,6),rep(8,6),rep(9,6),rep(10,6))
response<-c(50,49,50,50,48,51,52,52,51,51,51,51,53,50,50,54,52,51,49,51,50,48,50,51,48,49,48,48,49,48,52,50,50,52,50,50,51,51,51,51,50,50,52,50,49,53,48,50,50,51,50,51,48,49,47,46,49,46,47,48)
data.frame(operator,part,response)
##    operator part response
## 1         1    1       50
## 2         1    1       49
## 3         1    1       50
## 4         2    1       50
## 5         2    1       48
## 6         2    1       51
## 7         1    2       52
## 8         1    2       52
## 9         1    2       51
## 10        2    2       51
## 11        2    2       51
## 12        2    2       51
## 13        1    3       53
## 14        1    3       50
## 15        1    3       50
## 16        2    3       54
## 17        2    3       52
## 18        2    3       51
## 19        1    4       49
## 20        1    4       51
## 21        1    4       50
## 22        2    4       48
## 23        2    4       50
## 24        2    4       51
## 25        1    5       48
## 26        1    5       49
## 27        1    5       48
## 28        2    5       48
## 29        2    5       49
## 30        2    5       48
## 31        1    6       52
## 32        1    6       50
## 33        1    6       50
## 34        2    6       52
## 35        2    6       50
## 36        2    6       50
## 37        1    7       51
## 38        1    7       51
## 39        1    7       51
## 40        2    7       51
## 41        2    7       50
## 42        2    7       50
## 43        1    8       52
## 44        1    8       50
## 45        1    8       49
## 46        2    8       53
## 47        2    8       48
## 48        2    8       50
## 49        1    9       50
## 50        1    9       51
## 51        1    9       50
## 52        2    9       51
## 53        2    9       48
## 54        2    9       49
## 55        1   10       47
## 56        1   10       46
## 57        1   10       49
## 58        2   10       46
## 59        2   10       47
## 60        2   10       48
operator<-as.fixed(operator)
part<-as.random(part)
model<-aov(response~operator+part+operator*part)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: response
##               Df Sum Sq Mean Sq F value    Pr(>F)    
## operator       1  0.417  0.4167  0.6923    0.4269    
## part           9 99.017 11.0019  7.3346 3.216e-06 ***
## operator:part  9  5.417  0.6019  0.4012    0.9270    
## Residual      40 60.000  1.5000                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As p-value for operator (0.4269 ) are less than the value of the alpha(0.05). Therefore, we reject the Null Hypothesis.

As p-value for part is (3.216e-06) we reject hypothisis.