Part 1 of the project is involved, among other things, sample size recalculation of the sample size. The calculation is shown here, but the data and analysis will be submitted as part of the final report. This was recalculated using the the Intermediate formula for the F-Value.
library(pwr)
alphaLevel <- .05
confidence <- .75
d <- .5
numPop <- 3
fVal <- (d/2)*sqrt((numPop+1)/(3*(numPop-1)))
pwr.anova.test(k = numPop,n = NULL,f = fVal,sig.level = alphaLevel,power = confidence)
##
## Balanced one-way analysis of variance power calculation
##
## k = 3
## n = 69.73415
## f = 0.2041241
## sig.level = 0.05
## power = 0.75
##
## NOTE: n is number in each group
70 samples are need from each group.
Perform a designed experiment to determine the effect of Pin Elevation and Release Angle on distance in which a ball is thrown when Fire Angle is 100 degrees, Bungee Position is 150mm, and Cup Elevation is 250mm. Settings of the Pin Elevation at 100, 150, and 200mm should be investigated as a fixed effect, as well as settings of the Release Angle corresponding to 110, 140, and 170 degrees as a random effect. The design should be replicated three times.
State model equation with the null and alternative hypotheses to be tested. In addition, state the level of significance that will be used in your analysis.
The linear effects equation for this analysis is \[y_{ijk}=\mu+\alpha_i+\beta_j+\alpha\beta_{ij} + \epsilon_{ijk}\] The Hypotheseis are as follow:
\[H_0: \alpha\beta_{ij} = 0\ for\ all\ ij\] \[H_1: \alpha\beta_{ij} \ne 0\ for\ at\ least\ one\ ij\] \[H_0: \alpha_i = 0\ for\ all\ ij\] \[H_1: \alpha_i \ne 0\ for\ at\ least\ one\ i\] \[H_0: \beta_j = 0\ for\ all\ ij\] \[H_1: \beta_j \ne 0\ for\ at\ least\ one\ j\] In this analysis, a standard \(\alpha = 0.05\) will be used.
Propose a layout with a randomized run order
An experiment with 2 Factors with 3 levels per factor and 3 replications will be conducted.
library(agricolae)
trts <- c(3,3)
seedNum <- 1234567
experiment <- design.ab(trt = trts, r=3,design="crd",seed = seedNum)
The random data collection order is shown here below.
experiment$book
## plots r A B
## 1 101 1 1 2
## 2 102 1 1 3
## 3 103 1 3 3
## 4 104 1 3 2
## 5 105 1 2 3
## 6 106 1 2 2
## 7 107 1 2 1
## 8 108 2 1 2
## 9 109 1 1 1
## 10 110 2 2 3
## 11 111 2 3 3
## 12 112 2 3 2
## 13 113 3 1 2
## 14 114 2 1 1
## 15 115 2 1 3
## 16 116 1 3 1
## 17 117 3 3 2
## 18 118 2 2 2
## 19 119 3 2 3
## 20 120 2 3 1
## 21 121 2 2 1
## 22 122 3 1 3
## 23 123 3 2 1
## 24 124 3 2 2
## 25 125 3 1 1
## 26 126 3 3 3
## 27 127 3 3 1
Collect data and record observations on the layout proposed in part B
The data was collected using the online catapult per the data collection order shown above.
#read in the data
expData <- read.csv("C:/Users/fay/Documents/Scott Texas Tech/DoE/Project/Part2_Data.csv")
observation <- expData$Output
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.
pinEl <- as.fixed(expData$Pin.Elevation)
relAng <- as.random(expData$Release.Angle)
The following table shows collected data.
| Replicate | Pin.Elevation | Release.Angle | Output |
|---|---|---|---|
| 1 | 100 | 140 | 124 |
| 1 | 100 | 170 | 178 |
| 1 | 200 | 170 | 273 |
| 1 | 200 | 140 | 186 |
| 1 | 150 | 170 | 227 |
| 1 | 150 | 140 | 156 |
| 1 | 150 | 110 | 53 |
| 2 | 100 | 140 | 123 |
| 1 | 100 | 110 | 39 |
| 2 | 150 | 170 | 229 |
| 2 | 200 | 170 | 277 |
| 2 | 200 | 140 | 188 |
| 3 | 100 | 140 | 124 |
| 2 | 100 | 110 | 38 |
| 2 | 100 | 170 | 183 |
| 1 | 200 | 110 | 60 |
| 3 | 200 | 140 | 186 |
| 2 | 150 | 140 | 156 |
| 3 | 150 | 170 | 228 |
| 2 | 200 | 110 | 63 |
| 2 | 150 | 110 | 52 |
| 3 | 100 | 170 | 180 |
| 3 | 150 | 110 | 53 |
| 3 | 150 | 140 | 155 |
| 3 | 100 | 110 | 38 |
| 3 | 200 | 170 | 280 |
| 3 | 200 | 110 | 63 |
Test the hypotheses and state conclusions, determining those effects that are significant. Show any plots that might be useful/necessary to show your findings. You may also show residual plots and make appropriate comments, but do not transform the data (i.e. use the raw data regardless of normality and variance constancy)
The Analysis of Variance follows:
aov1 <- aov(observation~pinEl+relAng+pinEl*relAng)
gad(aov1)
## Analysis of Variance Table
##
## Response: observation
## Df Sum Sq Mean Sq F value Pr(>F)
## pinEl 2 16749 8374 8.4192 0.03685 *
## relAng 2 142985 71492 25398.5921 < 2e-16 ***
## pinEl:relAng 4 3979 995 353.3684 < 2e-16 ***
## Residual 18 51 3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qqnorm(aov1$residuals)
qqline(aov1$residuals)
boxplot(aov1$residuals~aov1$fitted.values)
interaction.plot(pinEl,relAng,observation)
interaction.plot(relAng,pinEl,observation)
The data looks to be normally distributed except for are few observations at the tails.
Would have some concerns about constant variance. However from the box plot, the residuals seem to be within whiskers listed.
Based on results of anova, the interaction of Pin Elevation and release angle is highly significant.
Below you will find a block containing all of the code used to generate this document
#Part 1 Rework
library(pwr)
alphaLevel <- .05
confidence <- .75
d <- .5
numPop <- 3
fVal <- (d/2)*sqrt((numPop+1)/(3*(numPop-1)))
pwr.anova.test(k = numPop,n = NULL,f = fVal,sig.level = alphaLevel,power = confidence)
#Part 2
library(agricolae)
trts <- c(3,3)
seedNum <- 1234567
experiment <- design.ab(trt = trts, r=3,design="crd",seed = seedNum)
experiment$book
#Part 2 Read in Data
expData <- read.csv("C:/Users/fay/Documents/Scott Texas Tech/DoE/Project/Part2_Data.csv")
observation <- expData$Output
library(GAD)
pinEl <- as.fixed(expData$Pin.Elevation)
relAng <- as.random(expData$Release.Angle)
#Part 2 Analysis
aov1 <- aov(observation~pinEl+relAng+pinEl*relAng)
gad(aov1)
qqnorm(aov1$residuals)
qqline(aov1$residuals)
boxplot(aov1$residuals~aov1$fitted.values)
interaction.plot(pinEl,relAng,observation)
interaction.plot(relAng,pinEl,observation)
```