Title: Design of Experiments-Project

Aim: Testing whether landing distance of three different balls are same or different.

Instructor - Dr.Timothy Matis

Authors: Sujit Thakur, Tajammul Mohammed, Gowtham Sasikumar


INTRODUCTION

This 3-part project was done using a statapult. We have designed experiments to find the significant factors that affect the distance in which the ball is thrown. The statapult has three parameters in our experiment:

• Pin Elevation

• Bungee Position

• Release Angle

Both the pin elevation and the bungee position have 4 settings which are numbered from bottom to the top. The release angle varies from 90 to 180 degrees as seen the figure above. Also, we have used 3 types of balls – yellow, red, and black.

Part 1

Section 1-A

Determining the size using power calculation

The total number of populations are three(3). So, the value of K is 3

As our K is odd and with maximum variability, Hence the formula of effect f is as follows

\(f\) = \((d/2)\)*\(\sqrt{K^2 -1}\)

where f = effect

d = effect size and the value of d is 0.5

x <- 0.08333*(sqrt(8))
pwr.anova.test(k=3,n=NULL,f=x,sig.level = 0.05 , power = 0.75)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 3
##               n = 52.55986
##               f = 0.2356928
##       sig.level = 0.05
##           power = 0.75
## 
## NOTE: n is number in each group

We can see from the power calculation that number of samples required per group is 53 , hence we need to collect a total of 159 observations since we have 3 different populations.

Section 1-B

Randomized Design of Sample Collection - Complete Random Design

trt <- c("yellow","red","black")
crd <- design.crd(trt,r=53,seed=1234)
crd$book 
##     plots  r    trt
## 1     101  1 yellow
## 2     102  2 yellow
## 3     103  3 yellow
## 4     104  1  black
## 5     105  4 yellow
## 6     106  2  black
## 7     107  5 yellow
## 8     108  1    red
## 9     109  6 yellow
## 10    110  7 yellow
## 11    111  3  black
## 12    112  2    red
## 13    113  4  black
## 14    114  3    red
## 15    115  5  black
## 16    116  6  black
## 17    117  7  black
## 18    118  8 yellow
## 19    119  8  black
## 20    120  4    red
## 21    121  9 yellow
## 22    122  5    red
## 23    123  6    red
## 24    124  7    red
## 25    125 10 yellow
## 26    126  9  black
## 27    127  8    red
## 28    128 10  black
## 29    129 11  black
## 30    130 11 yellow
## 31    131  9    red
## 32    132 10    red
## 33    133 12 yellow
## 34    134 11    red
## 35    135 12    red
## 36    136 13    red
## 37    137 13 yellow
## 38    138 14 yellow
## 39    139 14    red
## 40    140 15    red
## 41    141 12  black
## 42    142 13  black
## 43    143 16    red
## 44    144 14  black
## 45    145 15  black
## 46    146 15 yellow
## 47    147 16 yellow
## 48    148 16  black
## 49    149 17  black
## 50    150 17    red
## 51    151 17 yellow
## 52    152 18 yellow
## 53    153 18    red
## 54    154 18  black
## 55    155 19    red
## 56    156 20    red
## 57    157 19  black
## 58    158 20  black
## 59    159 21  black
## 60    160 22  black
## 61    161 21    red
## 62    162 22    red
## 63    163 23  black
## 64    164 23    red
## 65    165 24    red
## 66    166 24  black
## 67    167 19 yellow
## 68    168 25  black
## 69    169 20 yellow
## 70    170 25    red
## 71    171 26    red
## 72    172 27    red
## 73    173 21 yellow
## 74    174 22 yellow
## 75    175 28    red
## 76    176 23 yellow
## 77    177 29    red
## 78    178 30    red
## 79    179 31    red
## 80    180 24 yellow
## 81    181 26  black
## 82    182 25 yellow
## 83    183 26 yellow
## 84    184 27  black
## 85    185 27 yellow
## 86    186 28 yellow
## 87    187 32    red
## 88    188 29 yellow
## 89    189 28  black
## 90    190 30 yellow
## 91    191 29  black
## 92    192 30  black
## 93    193 31  black
## 94    194 33    red
## 95    195 32  black
## 96    196 31 yellow
## 97    197 34    red
## 98    198 33  black
## 99    199 34  black
## 100   200 32 yellow
## 101   201 33 yellow
## 102   202 34 yellow
## 103   203 35 yellow
## 104   204 36 yellow
## 105   205 35    red
## 106   206 36    red
## 107   207 37    red
## 108   208 38    red
## 109   209 35  black
## 110   210 37 yellow
## 111   211 36  black
## 112   212 38 yellow
## 113   213 39    red
## 114   214 39 yellow
## 115   215 40    red
## 116   216 37  black
## 117   217 38  black
## 118   218 39  black
## 119   219 41    red
## 120   220 40  black
## 121   221 40 yellow
## 122   222 41 yellow
## 123   223 42 yellow
## 124   224 43 yellow
## 125   225 41  black
## 126   226 44 yellow
## 127   227 42  black
## 128   228 43  black
## 129   229 44  black
## 130   230 45  black
## 131   231 42    red
## 132   232 43    red
## 133   233 44    red
## 134   234 45 yellow
## 135   235 46  black
## 136   236 45    red
## 137   237 47  black
## 138   238 46    red
## 139   239 48  black
## 140   240 46 yellow
## 141   241 47 yellow
## 142   242 49  black
## 143   243 47    red
## 144   244 48    red
## 145   245 50  black
## 146   246 48 yellow
## 147   247 49    red
## 148   248 50    red
## 149   249 51    red
## 150   250 51  black
## 151   251 52    red
## 152   252 49 yellow
## 153   253 50 yellow
## 154   254 51 yellow
## 155   255 52  black
## 156   256 52 yellow
## 157   257 53  black
## 158   258 53 yellow
## 159   259 53    red
order <- as.data.frame(crd$book)

Section 1-C

Collection of Data

data <- read_excel("C:\\Users\\sjtha\\OneDrive\\Documents\\Fall 2021\\Design Of Experiment - Dr-Matis\\Project\\Proj1 retake\\Maindata.xlsx")
data <- as.data.frame(data)
data
##     plots  r    trt Response
## 1     151 17 yellow       90
## 2     180 24 yellow       88
## 3     182 25 yellow       90
## 4     186 28 yellow       88
## 5     202 34 yellow       85
## 6     204 36 yellow       87
## 7     224 43 yellow       90
## 8     253 50 yellow       90
## 9     121  9 yellow       87
## 10    130 11 yellow       88
## 11    221 40 yellow       85
## 12    234 45 yellow       87
## 13    241 47 yellow       88
## 14    105  4 yellow       88
## 15    118  8 yellow       87
## 16    138 14 yellow       89
## 17    176 23 yellow       87
## 18    183 26 yellow       89
## 19    196 31 yellow       89
## 20    240 46 yellow       85
## 21    254 51 yellow       88
## 22    102  2 yellow       88
## 23    147 16 yellow       87
## 24    167 19 yellow       90
## 25    201 33 yellow       85
## 26    252 49 yellow       87
## 27    103  3 yellow       87
## 28    137 13 yellow       88
## 29    152 18 yellow       85
## 30    185 27 yellow       85
## 31    188 29 yellow       87
## 32    203 35 yellow       86
## 33    223 42 yellow       87
## 34    258 53 yellow       89
## 35    101  1 yellow       90
## 36    146 15 yellow       88
## 37    212 38 yellow       86
## 38    109  6 yellow       88
## 39    174 22 yellow       90
## 40    200 32 yellow       88
## 41    210 37 yellow       86
## 42    222 41 yellow       87
## 43    246 48 yellow       89
## 44    256 52 yellow       90
## 45    107  5 yellow       90
## 46    110  7 yellow       90
## 47    125 10 yellow       86
## 48    133 12 yellow       86
## 49    169 20 yellow       90
## 50    173 21 yellow       85
## 51    190 30 yellow       85
## 52    214 39 yellow       89
## 53    226 44 yellow       85
## 54    108  1    red       84
## 55    112  2    red       87
## 56    114  3    red       86
## 57    120  4    red       87
## 58    122  5    red       86
## 59    123  6    red       86
## 60    124  7    red       83
## 61    127  8    red       86
## 62    131  9    red       86
## 63    132 10    red       85
## 64    134 11    red       84
## 65    135 12    red       86
## 66    136 13    red       84
## 67    139 14    red       86
## 68    140 15    red       85
## 69    143 16    red       83
## 70    150 17    red       84
## 71    153 18    red       87
## 72    155 19    red       87
## 73    156 20    red       86
## 74    161 21    red       87
## 75    162 22    red       83
## 76    164 23    red       84
## 77    165 24    red       85
## 78    170 25    red       85
## 79    171 26    red       85
## 80    172 27    red       84
## 81    175 28    red       83
## 82    177 29    red       87
## 83    178 30    red       85
## 84    179 31    red       85
## 85    187 32    red       84
## 86    194 33    red       83
## 87    197 34    red       87
## 88    205 35    red       86
## 89    206 36    red       83
## 90    207 37    red       86
## 91    208 38    red       83
## 92    213 39    red       83
## 93    215 40    red       85
## 94    219 41    red       86
## 95    231 42    red       83
## 96    232 43    red       85
## 97    233 44    red       85
## 98    236 45    red       84
## 99    238 46    red       83
## 100   243 47    red       86
## 101   244 48    red       85
## 102   247 49    red       83
## 103   248 50    red       87
## 104   249 51    red       84
## 105   251 52    red       84
## 106   259 53    red       84
## 107   104  1  black       86
## 108   106  2  black       82
## 109   111  3  black       86
## 110   113  4  black       87
## 111   115  5  black       85
## 112   116  6  black       84
## 113   117  7  black       87
## 114   119  8  black       82
## 115   126  9  black       86
## 116   128 10  black       83
## 117   129 11  black       82
## 118   141 12  black       84
## 119   142 13  black       84
## 120   144 14  black       87
## 121   145 15  black       83
## 122   148 16  black       85
## 123   149 17  black       85
## 124   154 18  black       85
## 125   157 19  black       86
## 126   158 20  black       84
## 127   159 21  black       83
## 128   160 22  black       86
## 129   163 23  black       84
## 130   166 24  black       85
## 131   168 25  black       86
## 132   181 26  black       83
## 133   184 27  black       83
## 134   189 28  black       82
## 135   191 29  black       82
## 136   192 30  black       86
## 137   193 31  black       83
## 138   195 32  black       84
## 139   198 33  black       85
## 140   199 34  black       86
## 141   209 35  black       85
## 142   211 36  black       86
## 143   216 37  black       87
## 144   217 38  black       86
## 145   218 39  black       82
## 146   220 40  black       84
## 147   225 41  black       84
## 148   227 42  black       82
## 149   228 43  black       84
## 150   229 44  black       86
## 151   230 45  black       84
## 152   235 46  black       86
## 153   237 47  black       83
## 154   239 48  black       87
## 155   242 49  black       86
## 156   245 50  black       86
## 157   250 51  black       82
## 158   255 52  black       87
## 159   257 53  black       83
data$Response <- as.numeric(data$Response)
data$trt <- as.factor(data$trt)

Section 1-D

Hypothesis Testing

Notations :-

  • Yellow is ball 1
  • Red is ball 2
  • Black is ball 3

Null Hypothesis : \(H_o: \mu_1= \mu_2 = \mu_3 = \mu\)

Alternative Hypothesis : \(H_a\): at least one of the \(\mu_i\) differs

first.model <- aov(data$Response~data$trt,data = data)
summary(first.model)
##              Df Sum Sq Mean Sq F value Pr(>F)    
## data$trt      2  299.8  149.89   59.33 <2e-16 ***
## Residuals   156  394.1    2.53                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We can see that P value is <2e-16 which is smaller than the \(\alpha\) value of 0.05 .

Hence we reject Null Hypothesis , claiming that at least one of the mean differs.

Section 1-D-1

Checking our Anova Model Adequacy

plot(first.model,col="deepskyblue")

Conclusions on residual plots

  • From above residual plots we can state that our assumptions for anova model as follows:

  • As the residuals fall fairly in straight line in the Normal probability plot, it shows that the residuals are fairly normally distributed

  • The residual vs fitted value plot shows that variance does differ significantly as it shows a pattern of divergent funnel with convergent funnel at the end.

Section 1-D-2

Data Transformation

boxcox(first.model,col="deepskyblue")
## Warning: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
##  extra argument 'col' will be disregarded

We can see from above boxcox plot , the 95% confidence interval range intersects at -0.25 and so the value of lambda is chosen as -0.25

Following is the transformed data

lambda = -0.25
data2 <- data
data2$Response <- (data2$Response)^lambda
data2
##     plots  r    trt  Response
## 1     151 17 yellow 0.3246679
## 2     180 24 yellow 0.3264971
## 3     182 25 yellow 0.3246679
## 4     186 28 yellow 0.3264971
## 5     202 34 yellow 0.3293406
## 6     204 36 yellow 0.3274313
## 7     224 43 yellow 0.3246679
## 8     253 50 yellow 0.3246679
## 9     121  9 yellow 0.3274313
## 10    130 11 yellow 0.3264971
## 11    221 40 yellow 0.3293406
## 12    234 45 yellow 0.3274313
## 13    241 47 yellow 0.3264971
## 14    105  4 yellow 0.3264971
## 15    118  8 yellow 0.3274313
## 16    138 14 yellow 0.3255761
## 17    176 23 yellow 0.3274313
## 18    183 26 yellow 0.3255761
## 19    196 31 yellow 0.3255761
## 20    240 46 yellow 0.3293406
## 21    254 51 yellow 0.3264971
## 22    102  2 yellow 0.3264971
## 23    147 16 yellow 0.3274313
## 24    167 19 yellow 0.3246679
## 25    201 33 yellow 0.3293406
## 26    252 49 yellow 0.3274313
## 27    103  3 yellow 0.3274313
## 28    137 13 yellow 0.3264971
## 29    152 18 yellow 0.3293406
## 30    185 27 yellow 0.3293406
## 31    188 29 yellow 0.3274313
## 32    203 35 yellow 0.3283790
## 33    223 42 yellow 0.3274313
## 34    258 53 yellow 0.3255761
## 35    101  1 yellow 0.3246679
## 36    146 15 yellow 0.3264971
## 37    212 38 yellow 0.3283790
## 38    109  6 yellow 0.3264971
## 39    174 22 yellow 0.3246679
## 40    200 32 yellow 0.3264971
## 41    210 37 yellow 0.3283790
## 42    222 41 yellow 0.3274313
## 43    246 48 yellow 0.3255761
## 44    256 52 yellow 0.3246679
## 45    107  5 yellow 0.3246679
## 46    110  7 yellow 0.3246679
## 47    125 10 yellow 0.3283790
## 48    133 12 yellow 0.3283790
## 49    169 20 yellow 0.3246679
## 50    173 21 yellow 0.3293406
## 51    190 30 yellow 0.3293406
## 52    214 39 yellow 0.3255761
## 53    226 44 yellow 0.3293406
## 54    108  1    red 0.3303164
## 55    112  2    red 0.3274313
## 56    114  3    red 0.3283790
## 57    120  4    red 0.3274313
## 58    122  5    red 0.3283790
## 59    123  6    red 0.3283790
## 60    124  7    red 0.3313069
## 61    127  8    red 0.3283790
## 62    131  9    red 0.3283790
## 63    132 10    red 0.3293406
## 64    134 11    red 0.3303164
## 65    135 12    red 0.3283790
## 66    136 13    red 0.3303164
## 67    139 14    red 0.3283790
## 68    140 15    red 0.3293406
## 69    143 16    red 0.3313069
## 70    150 17    red 0.3303164
## 71    153 18    red 0.3274313
## 72    155 19    red 0.3274313
## 73    156 20    red 0.3283790
## 74    161 21    red 0.3274313
## 75    162 22    red 0.3313069
## 76    164 23    red 0.3303164
## 77    165 24    red 0.3293406
## 78    170 25    red 0.3293406
## 79    171 26    red 0.3293406
## 80    172 27    red 0.3303164
## 81    175 28    red 0.3313069
## 82    177 29    red 0.3274313
## 83    178 30    red 0.3293406
## 84    179 31    red 0.3293406
## 85    187 32    red 0.3303164
## 86    194 33    red 0.3313069
## 87    197 34    red 0.3274313
## 88    205 35    red 0.3283790
## 89    206 36    red 0.3313069
## 90    207 37    red 0.3283790
## 91    208 38    red 0.3313069
## 92    213 39    red 0.3313069
## 93    215 40    red 0.3293406
## 94    219 41    red 0.3283790
## 95    231 42    red 0.3313069
## 96    232 43    red 0.3293406
## 97    233 44    red 0.3293406
## 98    236 45    red 0.3303164
## 99    238 46    red 0.3313069
## 100   243 47    red 0.3283790
## 101   244 48    red 0.3293406
## 102   247 49    red 0.3313069
## 103   248 50    red 0.3274313
## 104   249 51    red 0.3303164
## 105   251 52    red 0.3303164
## 106   259 53    red 0.3303164
## 107   104  1  black 0.3283790
## 108   106  2  black 0.3323124
## 109   111  3  black 0.3283790
## 110   113  4  black 0.3274313
## 111   115  5  black 0.3293406
## 112   116  6  black 0.3303164
## 113   117  7  black 0.3274313
## 114   119  8  black 0.3323124
## 115   126  9  black 0.3283790
## 116   128 10  black 0.3313069
## 117   129 11  black 0.3323124
## 118   141 12  black 0.3303164
## 119   142 13  black 0.3303164
## 120   144 14  black 0.3274313
## 121   145 15  black 0.3313069
## 122   148 16  black 0.3293406
## 123   149 17  black 0.3293406
## 124   154 18  black 0.3293406
## 125   157 19  black 0.3283790
## 126   158 20  black 0.3303164
## 127   159 21  black 0.3313069
## 128   160 22  black 0.3283790
## 129   163 23  black 0.3303164
## 130   166 24  black 0.3293406
## 131   168 25  black 0.3283790
## 132   181 26  black 0.3313069
## 133   184 27  black 0.3313069
## 134   189 28  black 0.3323124
## 135   191 29  black 0.3323124
## 136   192 30  black 0.3283790
## 137   193 31  black 0.3313069
## 138   195 32  black 0.3303164
## 139   198 33  black 0.3293406
## 140   199 34  black 0.3283790
## 141   209 35  black 0.3293406
## 142   211 36  black 0.3283790
## 143   216 37  black 0.3274313
## 144   217 38  black 0.3283790
## 145   218 39  black 0.3323124
## 146   220 40  black 0.3303164
## 147   225 41  black 0.3303164
## 148   227 42  black 0.3323124
## 149   228 43  black 0.3303164
## 150   229 44  black 0.3283790
## 151   230 45  black 0.3303164
## 152   235 46  black 0.3283790
## 153   237 47  black 0.3313069
## 154   239 48  black 0.3274313
## 155   242 49  black 0.3283790
## 156   245 50  black 0.3283790
## 157   250 51  black 0.3323124
## 158   255 52  black 0.3274313
## 159   257 53  black 0.3313069

Section 1-D-3

Checking Model Adequacy on transformed data

second.model <- aov(data2$Response~data2$trt,data = data2)
plot(second.model,col="deepskyblue")

The transformed Residual vs fitted plot shows , the variability has stabalized to acceptable extent.

Hence pair wise comparison is performed next

Section 1-E

Investigating pairwise comparisons

tukey_firstmodel <- TukeyHSD(second.model)
tukey_firstmodel
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov.default(formula = data2$Response ~ data2$trt, data = data2)
## 
## $`data2$trt`
##                       diff          lwr           upr     p adj
## red-black    -0.0003546236 -0.001054971  0.0003457233 0.4560355
## yellow-black -0.0029324588 -0.003632806 -0.0022321119 0.0000000
## yellow-red   -0.0025778351 -0.003278182 -0.0018774882 0.0000000
plot(tukey_firstmodel,col="deepskyblue")

From TukeysHSD results and plot, we can claim that pair-Red and Black are similar because zero lies in the 95% confidence interval range.

The mean value of yellow differs from red as well as black. So the pairs of yellow-red and yellow-black differ significantly because 0 is not in the 95% confidence interval range.

Part 2

Section 2-A

Model Equation:

This is a mixed effects model since one factor has fixed effect and the other factor has random effect

\(Y_{ijk}\) = \(\mu\) + \(\alpha_i\) + \(\beta_j\) + \(\alpha\beta_{ij}\) + \(\epsilon_{ijk}\)

  • \(\alpha_i\) corresponds to the effect of pin elevation
  • \(\beta_j\) corresponds to the effect of release angle

Our Hypothesis for interaction effect (As this is a larger term we will start testing from this) will be:

Null Hypothesis: \(\sigma^2_{\alpha\beta} = 0\)

Alternative Hypothesis: \(\sigma^2_{\alpha\beta} \neq 0\)

Our Hypothesis for Main Effect of pin elevation:

This main factor has fixed effect on our model.

Main effect - Pin elevation - Hypothesis

Null Hypothesis: \(\alpha_i = 0\) For all i

Alternative Hypothesis: \(\alpha_i \neq 0\) for some i

Our Hypothesis for Main Effect of Release angle:

This main factor has a random effect on our model.

Main effect - Release Angle - Hypothesis

Null Hypothesis : \(\sigma^2_\beta = 0\)

Alternative Hypothesis : \(\sigma^2_\beta\) \(\neq 0\)

Our values for I = 2, J= 3, and K = 3.

  • I = levels of factor A (pin elevation)
  • J = levels of factor B (release angle)
  • K = replicates

We will use level of significance as \(\alpha\) = 0.05

Please note that:

  • “1” in Factor A (pin elevation ) is the bottom most location.
  • “2” in Factor A (Pin Elevation) is the third pin location from bottom.
  • “1” in Factor B corresponds to 110 degrees.
  • “2” in Factor B corresponds to 140 degrees.
  • “3” in Factor B corresponds to 170 degrees.

Section 2-B

Randomized Design Layout

trts <- c(2,3)
design <-  design.ab(trt = trts ,r =3 , design = "crd" , seed = 42069)
design$book
##    plots r A B
## 1    101 1 1 3
## 2    102 1 2 2
## 3    103 1 1 1
## 4    104 2 2 2
## 5    105 2 1 1
## 6    106 1 1 2
## 7    107 2 1 2
## 8    108 2 1 3
## 9    109 1 2 1
## 10   110 3 2 2
## 11   111 1 2 3
## 12   112 2 2 1
## 13   113 3 1 1
## 14   114 2 2 3
## 15   115 3 1 2
## 16   116 3 2 3
## 17   117 3 2 1
## 18   118 3 1 3

Hence we have collected the data as per the above randomized order, following is the data we collected:

Section 2-C

Data Collection

Factor_A <-  c("1","2","1","2","1","1","1","1","2","2","2","2","1","2","1","2","2","1")
Factor_B <- c("3","2","1","2","1","2","2","3","1","2","3","1","1","3","2","3","1","3")
Response <- c(48,38,25,38,21,35,40,45,28,47,60,27,23,57,39,59,27,45)
dat <- data.frame(Factor_A,Factor_B,Response)
dat$Factor_A <- as.fixed(dat$Factor_A)
dat$Factor_B <- as.random(dat$Factor_B)
dat
##    Factor_A Factor_B Response
## 1         1        3       48
## 2         2        2       38
## 3         1        1       25
## 4         2        2       38
## 5         1        1       21
## 6         1        2       35
## 7         1        2       40
## 8         1        3       45
## 9         2        1       28
## 10        2        2       47
## 11        2        3       60
## 12        2        1       27
## 13        1        1       23
## 14        2        3       57
## 15        1        2       39
## 16        2        3       59
## 17        2        1       27
## 18        1        3       45

Section 2-D

Hypothesis Testing

Testing Hypothesis now

model <- aov(Response~Factor_A+Factor_B+Factor_A*Factor_B,data = dat)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Response
##                   Df  Sum Sq Mean Sq  F value    Pr(>F)    
## Factor_A           1  200.00  200.00   4.8583    0.1583    
## Factor_B           2 2216.33 1108.17 152.2672 2.969e-09 ***
## Factor_A:Factor_B  2   82.33   41.17   5.6565    0.0186 *  
## Residual          12   87.33    7.28                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As we can see from above test, the P value for interaction effect is 0.0186 and we reject the null hypothesis stating that there is a significant interaction between the two factors (pin elevation and release angle).

Since we reject the null hypothesis for interaction effect, main effects don’t make more sense as the interaction effects masks the main effects.

Following is the interaction plot:

interaction.plot(Factor_A,Factor_B,Response,col="blue")

The Residual plots are:

plot(model,col="deepskyblue")

From the above residual plots we can see that if we neglect some outliers, the data looks fairly normally distributed.

Also, the residual vs fitted plot shows that the variances follow a diverging and then converging pattern which implies that the variances are not constant and so the model is not adequate.

Part 3

This is an unreplicated 2^4 design with four factors and each factor has a low level and a high level. The four factors are:

  • Factor A is Pin Elevation and it has two levels (-1 is the low level and it is position 1 and 1 is the high level and it is position 3)
  • Factor B is Bungee Position and it has two levels (-1 is the low level and it is position 2 and 1 is the high level and it is position 3)
  • Factor C is Release Angle and it has two levels (-1 is the low level and it is 140 degrees and 1 is the high level and it is 170 degrees)
  • Factor D is Ball Type and it has two levels (-1 is the low level and it is yellow ball and 1 is the high level and it is red ball)

Section 3-A and 3-B

Proposing data collection layout and recording observations

Data collection layout

trts <- c(2,2,2,2)
design <-  design.ab(trt = trts ,r =1 , design = "crd" , seed = 42069)
design$book
##    plots r A B C D
## 1    101 1 2 1 1 2
## 2    102 1 2 2 2 2
## 3    103 1 2 1 1 1
## 4    104 1 1 1 1 2
## 5    105 1 1 1 2 1
## 6    106 1 1 1 1 1
## 7    107 1 1 2 1 1
## 8    108 1 1 2 1 2
## 9    109 1 1 2 2 1
## 10   110 1 1 2 2 2
## 11   111 1 2 1 2 1
## 12   112 1 2 2 1 2
## 13   113 1 2 2 1 1
## 14   114 1 1 1 2 2
## 15   115 1 2 1 2 2
## 16   116 1 2 2 2 1
dataorder<-read_excel("dataorder.xlsx")
dataorder<-as.data.frame(dataorder)
dataorder
##    plots r  A  B  C  D Values
## 1    101 1  1 -1 -1  1     31
## 2    102 1  1  1  1  1     62
## 3    103 1  1 -1 -1 -1     46
## 4    104 1 -1 -1 -1  1     28
## 5    105 1 -1 -1  1 -1     44
## 6    106 1 -1 -1 -1 -1     35
## 7    107 1 -1  1 -1 -1     34
## 8    108 1 -1  1 -1  1     33
## 9    109 1 -1  1  1 -1     47
## 10   110 1 -1  1  1  1     38
## 11   111 1  1 -1  1 -1     64
## 12   112 1  1  1 -1  1     36
## 13   113 1  1  1 -1 -1     35
## 14   114 1 -1 -1  1  1     42
## 15   115 1  1 -1  1  1     55
## 16   116 1  1  1  1 -1     58

Section3- C

Model Equation:

Model Equation:

\(Y_{ijkl}\) = \(\mu\) + \(\alpha_i\) + \(\beta_j\) + \(\alpha\beta_{ij}\) + \(\gamma_k\) + \(\alpha\gamma_{ik}\) + \(\beta\gamma_{jk}\) + \(\alpha\beta\gamma_{ijk}\) + \(\delta_l\) + \(\alpha\delta_{il}\) + \(\beta\delta_{jl}\) + \(\gamma\delta_{kl}\) + \(\alpha\beta\delta_{ijl}\) + \(\alpha\gamma\delta_{ikl}\) + \(\beta\gamma\delta_{jkl}\) + \(\alpha\beta\gamma\delta_{ijkl}\) + \(\epsilon_{ijkl}\)

  • \(\alpha_i\) corresponds to Factor A (Pin Elevation)
  • \(\beta_j\) corresponds to Factor B (Bungee Position)
  • \(\gamma_k\) corresponds to Factor C (Release Angle)
  • \(\delta_l\) corresponds to Factor D (Ball Type)
model<-lm(Values~A*B*C*D,data = dataorder)
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] C   A   A:C D

coef(model)
##   (Intercept)             A             B             C             D 
##  4.300000e+01  5.375000e+00 -1.250000e-01  8.250000e+00 -2.375000e+00 
##           A:B           A:C           B:C           A:D           B:D 
## -5.000000e-01  3.125000e+00  1.250000e-01 -8.448103e-16  1.750000e+00 
##           C:D         A:B:C         A:B:D         A:C:D         B:C:D 
##  3.750000e-01  7.500000e-01  1.875000e+00  7.500000e-01 -1.000000e+00 
##       A:B:C:D 
##  6.250000e-01

From the halfnormal plots, we could see that the significant factors are A,C,A:C and D. This means that now the model is just run with only these effects and the other effects are clubbed into the error term. This means that only the Pin Elevation, Release Angle and the Ball type has a significant effect on the model

Section 3-D

Performing Anova for determining final model equation

Now the hypothesis that are being tested are

Main effect - Pin elevation - Hypothesis

Null Hypothesis: \(\alpha_i = 0\) For all i

Alternative Hypothesis: \(\alpha_i \neq 0\) for some i

Main effect - Release angle - Hypothesis

Null Hypothesis: \(\gamma_k = 0\) For all k

Alternative Hypothesis: \(\gamma_k \neq 0\) for some k

Main effect - Ball Type - Hypothesis

Null Hypothesis: \(\delta_l = 0\) For all l

Alternative Hypothesis: \(\delta_l \neq 0\) for some l

Interaction effect - Pin Elevation * Release Angle(AC) - Hypothesis

Null Hypothesis: \(\alpha\gamma_{ik} = 0\)

Alternative Hypothesis: \(\alpha\gamma_{ik} \neq 0\)

dataorder1<-dataorder[,c("A","C","D","Values")]
dataorder1
##     A  C  D Values
## 1   1 -1  1     31
## 2   1  1  1     62
## 3   1 -1 -1     46
## 4  -1 -1  1     28
## 5  -1  1 -1     44
## 6  -1 -1 -1     35
## 7  -1 -1 -1     34
## 8  -1 -1  1     33
## 9  -1  1 -1     47
## 10 -1  1  1     38
## 11  1  1 -1     64
## 12  1 -1  1     36
## 13  1 -1 -1     35
## 14 -1  1  1     42
## 15  1  1  1     55
## 16  1  1 -1     58
dataorder1$A<-as.fixed(dataorder1$A)
dataorder1$C<-as.fixed(dataorder1$C)
dataorder1$D<-as.fixed(dataorder1$D)
model1<-aov(Values~A*C+D,data = dataorder1)
GAD::gad(model1)
## Analysis of Variance Table
## 
## Response: Values
##          Df  Sum Sq Mean Sq F value    Pr(>F)    
## A         1  462.25  462.25 33.3974  0.000123 ***
## C         1 1089.00 1089.00 78.6798 2.416e-06 ***
## D         1   90.25   90.25  6.5205  0.026826 *  
## A:C       1  156.25  156.25 11.2890  0.006365 ** 
## Residual 11  152.25   13.84                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

From the ANOVA table, we could see that the p-value for factor A is 0.00012, p-value for Factor C is 0.0000024, p-value for interaction AC is 0.0063 and p-value for Factor D is 0.026. These results shows that these factors are significant since these values are less than the \(\alpha\) value of 0.05 and so we reject the null hypothesis and claim that they have a significant effect on the model.

The final model equation would be:

\(Y_{ikl}\) = \(\mu\) + \(\alpha_i\) + \(\gamma_k\) + \(\alpha\gamma_{ik}\) + \(\delta_l\) + \(\epsilon_{ikl}\)

  • \(\alpha_i\) corresponds to Factor A (Pin Elevation)
  • \(\gamma_k\) corresponds to Factor C (Release Angle)
  • \(\delta_l\) corresponds to Factor D (Ball Type)
  • \(\alpha\gamma_{ik}\) corresponds to the interaction effect of factor A and C(Pin elevation*release angle)
  • \(\epsilon_{ikl}\) is the standard error term

APPENDIX

The following is all the R Markdown Code which we have used to knit our report:

knitr::opts_chunk$set(echo = TRUE)
library(pwr)
library(agricolae)
library(readxl)

library(MASS)
library(GAD)
library(DoE.base)
x <- 0.08333*(sqrt(8))
pwr.anova.test(k=3,n=NULL,f=x,sig.level = 0.05 , power = 0.75)
trt <- c("yellow","red","black")
crd <- design.crd(trt,r=53,seed=1234)
crd$book 
order <- as.data.frame(crd$book)

data <- read_excel("C:\\Users\\sjtha\\OneDrive\\Documents\\Fall 2021\\Design Of Experiment - Dr-Matis\\Project\\Proj1 retake\\Maindata.xlsx")
data <- as.data.frame(data)
data
data$Response <- as.numeric(data$Response)
data$trt <- as.factor(data$trt)
first.model <- aov(data$Response~data$trt,data = data)
summary(first.model)
plot(first.model,col="deepskyblue")
boxcox(first.model,col="deepskyblue")
lambda = -0.25
data2 <- data
data2$Response <- (data2$Response)^lambda
data2
#Part 2
trts <- c(2,3)
design <-  design.ab(trt = trts ,r =3 , design = "crd" , seed = 42069)
design$book
Factor_A <-  c("1","2","1","2","1","1","1","1","2","2","2","2","1","2","1","2","2","1")
Factor_B <- c("3","2","1","2","1","2","2","3","1","2","3","1","1","3","2","3","1","3")
Response <- c(48,38,25,38,21,35,40,45,28,47,60,27,23,57,39,59,27,45)
dat <- data.frame(Factor_A,Factor_B,Response)
dat$Factor_A <- as.fixed(dat$Factor_A)
dat$Factor_B <- as.random(dat$Factor_B)
dat
model <- aov(Response~Factor_A+Factor_B+Factor_A*Factor_B,data = dat)
GAD::gad(model)
interaction.plot(Factor_A,Factor_B,Response,col="blue")
plot(model,col="deepskyblue")
#Part 3
trts <- c(2,2,2,2)
design <-  design.ab(trt = trts ,r =1 , design = "crd" , seed = 42069)
design$book
dataorder<-read_excel("dataorder.xlsx")
dataorder<-as.data.frame(dataorder)
dataorder
model<-lm(Values~A*B*C*D,data = dataorder)
halfnormal(model)
coef(model)
dataorder1<-dataorder[,c("A","C","D","Values")]
dataorder1$A<-as.fixed(dataorder1$A)
dataorder1$C<-as.fixed(dataorder1$C)
dataorder1$D<-as.fixed(dataorder1$D)
model1<-aov(Values~A*C+D,data = dataorder1)
GAD::gad(model1)

ACKNOWLEDGEMENT

Group 1 would like to thank Dr. Timothy Matis and Mr. Pritom Mondal for their help and guidance throughout this project and course.

REFERENCES

2. Texas Tech University - IE 5342, Course material and videos by Dr. Timothy Matis.

3. Montgomery, Douglas C.. Design and Analysis of Experiments. United Kingdom, Wiley, 2013.

5. Libraries used:

  • pwr
  • agricolae
  • readxl
  • writexl
  • MASS
  • GAD
  • DoE.base