Required Libraries:
library(agricolae)
## Warning: package 'agricolae' was built under R version 4.1.3
library(GAD)
## Warning: package 'GAD' was built under R version 4.1.3
## Loading required package: matrixStats
## Warning: package 'matrixStats' was built under R version 4.1.3
## Loading required package: R.methodsS3
## Warning: package 'R.methodsS3' was built under R version 4.1.3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.3
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.1.3
## 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
library(pwr)
## Warning: package 'pwr' was built under R version 4.1.3
library(MASS)
Determine how many samples should be collected to detect a mean difference with a large effect (i.e. 90% of the standard deviation) and a pattern of maximum variability with a probability of 55%.
The sample size is determined from the following chunk of code:
pwr.anova.test(k=3,n=NULL,f=((0.9*sqrt((3^2)-1))/(2*3)),sig.level = 0.05,power = 0.55)
##
## Balanced one-way analysis of variance power calculation
##
## k = 3
## n = 11.35348
## f = 0.4242641
## sig.level = 0.05
## power = 0.55
##
## NOTE: n is number in each group
So, we collect 12 samples per group, i.e 36 samples in total for the 3 types of balls.
Propose a layout using the number of samples from part (a) with randomized run order
The proposed layout is generated with the following code chunk:
trt<-c("golf", "tennis", "rock")
experimentdesign<-design.crd(trt=trt,r= 12,seed= 5000)
experimentdesign$book
## plots r trt
## 1 101 1 tennis
## 2 102 1 golf
## 3 103 2 golf
## 4 104 3 golf
## 5 105 1 rock
## 6 106 2 rock
## 7 107 2 tennis
## 8 108 3 rock
## 9 109 4 rock
## 10 110 5 rock
## 11 111 6 rock
## 12 112 7 rock
## 13 113 8 rock
## 14 114 3 tennis
## 15 115 4 tennis
## 16 116 5 tennis
## 17 117 9 rock
## 18 118 4 golf
## 19 119 5 golf
## 20 120 6 golf
## 21 121 6 tennis
## 22 122 10 rock
## 23 123 7 golf
## 24 124 8 golf
## 25 125 11 rock
## 26 126 9 golf
## 27 127 10 golf
## 28 128 7 tennis
## 29 129 8 tennis
## 30 130 9 tennis
## 31 131 12 rock
## 32 132 11 golf
## 33 133 10 tennis
## 34 134 12 golf
## 35 135 11 tennis
## 36 136 12 tennis
Part 1 (c)
Collect data and record observation in the proposed layout in part 1(a)
We input the data and define the variables for further calculation as follows:
Obs1<-c(40,43,51,36,44,56,39,61,40,44,55,34,43,40,41,51,40,45,58,59,46,49,36,50,33,37,37,37,36,35,32,46,38,46,31,32)
Balls1<-c(2,1,1, 1, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 1, 1, 1, 2, 3, 1, 1, 3, 1, 1, 2, 2, 2, 3, 1, 2, 1, 2, 2)
Balls1 <- as.factor(Balls1)
dat1<-data.frame(Obs1,Balls1)
ggplot(dat1, aes (x = Balls1, y = Obs1, fill = Balls1))+geom_boxplot()+
labs(title="Variance Check for Test 1",x="Ball Type", y = "Distance (cm)")+
theme_classic()
qqnorm(Obs1)
qqline(Obs1)
For the variance box plot, we have 1 = Golf, 2 = Tennis, 3 = Rock
From our initial observation we can see that the variance may not appear to be equal for different types of balls. Specially, the tennis showed far less variability compared to the other two. But, we cannot conclude based on just this, we need to check the residuals in the next sections.
Perform hypothesis test an check residuals. Be sure to comment and take corrective actions if necessary.
This is a one-factor ANOVA, so for or hypothesis testing, we have-
If μ1, μ2, and μ3 are the means of the Golf, Tennis, and Rock, then-
Null Hypothesis, Ho: μ1 = μ2 = μ3
Alternative Hypothesis, Ha: At least one of the means differ.
Now, we perform ANOVA on our proposed model:
model_aov<-aov(Obs1~Balls1, data = dat1)
summary(model_aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Balls1 2 291.1 145.53 2.356 0.111
## Residuals 33 2038.6 61.78
plot(model_aov)
From our ANOVA analysis, we can see that the obtained p-value is 0.11 which is greater than our level of significance of 0.05. Hence, we fail to reject our null hypothesis. Hence, we conclude that the mean distance for all the 3 different types of balls are the same.
Also from the residual plots, we see that the width of the variance are fairly equal in the residuals vs fitted values plot. Also, the residuals appear to be normally distributed. So, our assumption of normality and equal variance for ANOVA stands out. Hence, our model is adequate.
Part 1 (e)
If the null hypothesis is rejected, investigate pairwise comparisons.
Although, we did not reject the null hypothesis as per the original data that we obtained, we still move forward and make the pairwise comparison. For the pairwise comparison we resort to Tukey’s HSD post-hoc test:
TukeyHSD(model_aov)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov.default(formula = Obs1 ~ Balls1, data = dat1)
##
## $Balls1
## diff lwr upr p adj
## 2-1 -6.500000 -14.37354 1.373536 0.1218591
## 3-1 -1.083333 -8.95687 6.790203 0.9392159
## 3-2 5.416667 -2.45687 13.290203 0.2247660
plot(TukeyHSD(model_aov))
So from the pairwise test, we see that all the pairs whether 2-1, 3-1, or 3-2- All of them have 0 passing through them. So, none of them are significantly different pairs. This is obvious since we failed to reject our null hypothesis in the first place.
State all findings and make recommendations.
Major findings:
Future Recommendations:
The elasticity of the band kept changing after every throw. This could have impacted our result. Also, we observed that the band we used used for the experiment was not a single-piece of band, but rather 3 bands tied to each other. After a while in our experiment, we observed that the ties were coming loose. So, its very much probable that the tension in the bands kept changing after each throw. Hence the experiment could have additional nuisance variable which is the changing tension of the band over time. One suggestion to overcome this would be to use a single band instead of using a make-shift band with multiple ties. Another approach could be that we perform a block-experiment. Such as, suppose we have 36 data to collect. We assume that the tension keeps changing over every 6 throws. So we can partition our collected data into 6 blocks. That way, we can ensure that the change of tension does not have any effect on our final model.
Perform a designed experiment to determine the effect of Pin Elevation and Release Angle on distance in which a red ball is thrown when the Bungee Position is fixed at the second position. Settings one and three of Pin Elevation should be investigated as a fixed effect, as well as settings of the Release Angle corresponding to 90, 110, 120 degrees as a random effect. The design should be replicated three times.
Required Libraries
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 current part of the project investigates two factors with different levels. They are as follows:
Hence, we have a mixed model effect with the following model equation:
Yijk = μ + αi +σβj2 + ∈ijk
Where, μ = Grand Mean
αi = Effect of Factor 1 (Pin Elevation)
σβj2 = Variance of Factor 2 (Angle)
∈ijk = Random Error
Null Hypothesis, Ho: αi = 0
σβj2 = 0
Alternative Hypothesis, Ha: αi ≠ 0
σβj2 ≠ 0
Level of Significance: For this part of the project, we choose a level of significance of 0.05.
Propose a layout with a randomized run order.
The proposed run order would be a factorial design with 3 replications for each sets of observations. The order of run/ or data collection is considered completely random (CRD). We did not include any blocking effect in this study. The following codes used to generate our factorial table:
treat2 <- c(2,3)
design2 <- design.ab(trt = treat2, r = 3, design = "crd", seed = 5000)
design2$book
## plots r A B
## 1 101 1 2 3
## 2 102 1 1 3
## 3 103 2 2 3
## 4 104 1 2 1
## 5 105 2 2 1
## 6 106 1 1 2
## 7 107 1 1 1
## 8 108 1 2 2
## 9 109 2 1 1
## 10 110 2 1 2
## 11 111 2 1 3
## 12 112 3 1 2
## 13 113 2 2 2
## 14 114 3 2 3
## 15 115 3 2 2
## 16 116 3 1 3
## 17 117 3 1 1
## 18 118 3 2 1
The generated table was then used to collect data for our response variable (distance) in the subsequent sections.
Collect data and record observations on the layout proposed in part (a)
The data is collected as per the instructions provided in the original question. The following chunks of code was used to enter and sort data into the r compiler:
elevation2 <- c(3,1,3,3,3,1,1,3,1,1,1,1,3,3,3,1,1,3)
angle2 <- c(120,120,120,90,90,110,90,110,90,110,120,110,110,120,110,120,90,90)
distance2 <- c(41,13,31,39,47,23,26,50,30,24,12,24,48,33,47,10,25,53)
elevation2 <- as.fixed(elevation2)
angle2 <- as.random(angle2)
data2 <- data.frame(elevation2, angle2, distance2)
str(data2)
## 'data.frame': 18 obs. of 3 variables:
## $ elevation2: Factor w/ 2 levels "1","3": 2 1 2 2 2 1 1 2 1 1 ...
## $ angle2 : Factor w/ 3 levels "90","110","120": 3 3 3 1 1 2 1 2 1 2 ...
## $ distance2 : num 41 13 31 39 47 23 26 50 30 24 ...
We now visualize our collected data and see how the variance and data is distributed:
ggplot(data2, aes (x = elevation2, y = distance2, fill = elevation2))+geom_boxplot()+
labs(title="Elevation effect on Distance",x="Elevation Level", y = "Distance (cm)")+
theme_classic()
ggplot(data2, aes (x = angle2, y = distance2, fill = angle2))+geom_boxplot()+
labs(title="Effect of throw angle on distance",x="Angle", y = "Distance (cm)")+
theme_classic()
qqnorm(distance2)
qqline(distance2)
From our initial data plotting, we see that our collected response variable (distance) follows a fairly linear or normal pattern. From the box plot of elevation vs distance, we see that elevation does have an impact on the distance from the difference in the data distribution, although the variance seems to be close (from the width of the interquartile boxes).
Also, Angle seems to have an impact on the distance thrown, when the throw angle > 110. At 120 degrees throw angle, the distance thrown is the lowest. At 90 and 110 degrees, the throw distance is fairly close to each other. Also the variance seem to be close to each other which we can infer from the interquartile box widths.
But for better analysis and strong statistical evidence, we need to conduct statistical tests which are performed in the subsequent section.
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).
We perform the analysis of variance (ANOVA) based on our initial hypothesis shown in part2(a), with mixed model consideration and level of significance at 0.05.
The following code chunk was used to calculate the ANOVA results considering interaction events.
anova2 <- aov(distance2~elevation2+angle2+elevation2*angle2)
summary(anova2)
## Df Sum Sq Mean Sq F value Pr(>F)
## elevation2 1 2266.9 2266.9 152.254 3.54e-08 ***
## angle2 2 677.3 338.7 22.746 8.27e-05 ***
## elevation2:angle2 2 23.1 11.6 0.776 0.482
## Residuals 12 178.7 14.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction.plot(x.factor = angle2, trace.factor = elevation2, response = distance2, main = "Elevation vs Angle interaction", xlab = "Angle", ylab = "Distance", col = c("Red", "Blue"))
From our ANOVA table, we observe that our P-value for both the factors in consideration have p-values << 0.05. Hence, both the factors (elevation and angle) has significant effect on the response variable (distance).
Hence, we reject the null hypothesis for both the factors.
Also, the interaction of the angle and elevation combined did not seem to have any significant effect on the distance. This is also evident from the interaction plot that shows that the difference in distance thrown remains fairly similar for different levels of elevation at their corresponding angle levels.
Next, we analyze the residuals to check the model adequacy:
plot(anova2)
From the residual plots, we observe that although the residuals have fairly a decent normal distribution, the variance does not appear to be constant as inferred from the residuals vs fitted values plot.
Hence, we can conclude that the strong ANOVA assumption of constant variance has been violated.
Propose a data collection layout with a randomized run order
The proposed layout is generated as follows:
treatment3 <- c(2,2,2,2)
table3 <- design.ab(trt = treatment3, seed = 5000, r = 1, design = "crd")
table3$book
## plots r A B C D
## 1 101 1 2 2 2 2
## 2 102 1 2 1 2 2
## 3 103 1 1 2 2 2
## 4 104 1 2 2 1 2
## 5 105 1 2 1 1 2
## 6 106 1 2 1 2 1
## 7 107 1 1 1 2 2
## 8 108 1 1 1 1 2
## 9 109 1 1 1 2 1
## 10 110 1 1 2 2 1
## 11 111 1 1 1 1 1
## 12 112 1 1 2 1 1
## 13 113 1 1 2 1 2
## 14 114 1 2 1 1 1
## 15 115 1 2 2 2 1
## 16 116 1 2 2 1 1
Collect data and record observations The data is collected and entered into R using the following chunks of code:
Pin_Elevation <- c(-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1)
Bungee_Position <- c(1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1)
Release_Angle <- c(1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,1,-1,-1)
Ball_Type <- c(1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1)
Obs <- c(24,35,21,42,58,41,44,18,47,45,24,53,20,19,23,23)
dat <- data.frame(Pin_Elevation,Bungee_Position,Release_Angle,Ball_Type,Obs)
State model equation and determine what factors/interactions appear to be significant (show any plots that were used in making this determination)
This is a single replicate of a \(2^4\) factorial design, where the number of factors = 4 and each factor has 2 levels (with low and high).
Model Equation:
\(Y_{ijklm}\) = \(\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}+\alpha\beta\delta_{ijl}+\gamma\delta_{kl}+\alpha\gamma\delta_{ikl}+\beta\gamma\delta_{jkl}+\alpha\beta\gamma\delta_{ijkl}+\epsilon_{ijklm}\)
Where \(\mu\), \(\alpha_i\), \(\beta_j\), \(\gamma_k\), \(\delta_l\), and \(\epsilon\)~N(0,\(\sigma^2\)) are the Grand mean, main effects of the factor Pin Elevation, Bungee Position, Release Angle, the Ball Type and the Random Error respectively.
model <- lm(Obs~Pin_Elevation*Bungee_Position*Release_Angle*Ball_Type,data=dat)
coef(model)
## (Intercept)
## 33.5625
## Pin_Elevation
## 12.0625
## Bungee_Position
## 3.4375
## Release_Angle
## 0.1875
## Ball_Type
## -0.6875
## Pin_Elevation:Bungee_Position
## 1.4375
## Pin_Elevation:Release_Angle
## 0.4375
## Bungee_Position:Release_Angle
## 1.0625
## Pin_Elevation:Ball_Type
## -0.4375
## Bungee_Position:Ball_Type
## 0.9375
## Release_Angle:Ball_Type
## 0.6875
## Pin_Elevation:Bungee_Position:Release_Angle
## 0.3125
## Pin_Elevation:Bungee_Position:Ball_Type
## 0.6875
## Pin_Elevation:Release_Angle:Ball_Type
## 0.6875
## Bungee_Position:Release_Angle:Ball_Type
## 1.8125
## Pin_Elevation:Bungee_Position:Release_Angle:Ball_Type
## 1.8125
halfnormal(model)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] Pin_Elevation Bungee_Position
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Bungee_Position, response = dat$Obs, main = "Bungee Position vs Pin Elevation interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Red", "Blue"))
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Release_Angle, response = dat$Obs, main = "Bungee Position vs Release Angle interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Green", "Pink"))
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Ball_Type, response = dat$Obs, main = "Bungee Position vs Ball Type interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Black", "orange"))
From the half normal plot, we see that only the factors Pin Elevation and the Bungee Position are significant and the remaining factors/interaction terms are not significant and they look alike the random error term \(\epsilon_{ijklm}\).
Also in the interaction plots, we do not see any significant cross-over in terms of converging or diverging lines.
After using insignificant factors/interactions to create an error term, perform ANOVA to determine a final model equation using an alpha = 0.05
library(GAD)
Pin_Elevation <- c(-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1)
Bungee_Position <- c(1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1)
Obs <- c(24,35,21,42,58,41,44,18,47,45,24,53,20,19,23,23)
Pin_Elevation <- as.fixed(Pin_Elevation)
Bungee_Position <- as.fixed(Bungee_Position)
dat <- data.frame(Pin_Elevation,Bungee_Position,Obs)
dat
## Pin_Elevation Bungee_Position Obs
## 1 -1 1 24
## 2 1 -1 35
## 3 -1 -1 21
## 4 1 -1 42
## 5 1 1 58
## 6 1 -1 41
## 7 1 1 44
## 8 -1 -1 18
## 9 1 1 47
## 10 1 -1 45
## 11 -1 1 24
## 12 1 1 53
## 13 -1 -1 20
## 14 -1 -1 19
## 15 -1 1 23
## 16 -1 1 23
model <- aov(Obs~Pin_Elevation+Bungee_Position,data=dat)
gad(model)
## Analysis of Variance Table
##
## Response: Obs
## Df Sum Sq Mean Sq F value Pr(>F)
## Pin_Elevation 1 2328.06 2328.06 144.94 2.01e-08 ***
## Bungee_Position 1 189.06 189.06 11.77 0.00447 **
## Residual 13 208.81 16.06
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Hypothesis Testing:
Null Hypothesis \(H_0\): \(\alpha_i=0\) for all i
Alternative Hypothesis \(H_a\): \(\alpha_i\neq0\) for some i
Null Hypothesis \(H_0\): \(\beta_j=0\) for all j
Alternative Hypothesis \(H_a\): \(\beta_j\neq0\) for some j
From the summary of ANOVA, we see that the p-values of the factors Pin Elevation (2.01e-08) and the Bungee Position (0.00447) are less than \(\alpha=0.05\) level of significance and therefore, we reject the Null hypothesis. Hence, these two factors Pin Elevation and Bungee Position have a significant impact on the model.
Final Model Equation:
\(Y_{ijm} = \mu+\alpha_i+\beta_j+\epsilon_{ijm}\)
Where, \(\mu\), \(\alpha_i\), \(\beta_j\), and \(\epsilon_{ijm}\)~N(0,\(\sigma^2\)) are the Grand mean, the main effect of the factors Pin Elevation, Bungee Position and the Random Error respectively.
#Required Libraries
library(agricolae)
library(GAD)
library(ggplot2)
library(DoE.base)
#PART-1:
#(a)
pwr.anova.test(k=3,n=NULL,f=((0.9*sqrt((3^2)-1))/(2*3)),sig.level = 0.05,power = 0.55)
#(b)
trt<-c("golf", "tennis", "rock")
experimentdesign<-design.crd(trt=trt,r= 12,seed= 5000)
experimentdesign$book
#(c)
Obs1<-c(40,43,51,36,44,56,39,61,40,44,55,34,43,40,41,51,40,45,58,59,46,49,36,50,33,37,37,37,36,35,32,46,38,46,31,32)
Balls1<-c(2,1,1, 1, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 1, 1, 1, 2, 3, 1, 1, 3, 1, 1, 2, 2, 2, 3, 1, 2, 1, 2, 2)
Balls1 <- as.factor(Balls1)
dat1<-data.frame(Obs1,Balls1)
ggplot(dat1, aes (x = Balls1, y = Obs1, fill = Balls1))+geom_boxplot()+
labs(title="Variance Check for Test 1",x="Ball Type", y = "Distance (cm)")+
theme_classic()
qqnorm(Obs1)
qqline(Obs1)
#(d)
model_aov<-aov(Obs1~Balls1, data = dat1)
summary(model_aov)
plot(model_aov)
#(e)
TukeyHSD(model_aov)
plot(TukeyHSD(model_aov))
#PART 2
#Entering and sorting data
?design.ab
treat2 <- c(2,3)
design2 <- design.ab(trt = treat2, r = 3, design = "crd", seed = 5000)
design2$book
elevation2 <- c(3,1,3,3,3,1,1,3,1,1,1,1,3,3,3,1,1,3)
angle2 <- c(120,120,120,90,90,110,90,110,90,110,120,110,110,120,110,120,90,90)
distance2 <- c(41,13,31,39,47,23,26,50,30,24,12,24,48,33,47,10,25,53)
elevation2 <- as.fixed(elevation2)
angle2 <- as.random(angle2)
data2 <- data.frame(elevation2, angle2, distance2)
str(data2)
#Initial Data Visualization
ggplot(data2, aes (x = elevation2, y = distance2, fill = elevation2))+geom_boxplot()+
labs(title="Elevation effect on Distance",x="Elevation Level", y = "Distance (cm)")+
theme_classic()
ggplot(data2, aes (x = angle2, y = distance2, fill = angle2))+geom_boxplot()+
labs(title="Effect of throw angle on distance",x="Angle", y = "Distance (cm)")+
theme_classic()
qqnorm(distance2)
qqline(distance2)
#ANOVA/GAD
anova2 <- aov(distance2~elevation2+angle2+elevation2*angle2)
summary(anova2)
plot(anova2)
#PART 3
treat2 <- c(2,3)
design2 <- design.ab(trt = treat2, r = 3, design = "crd", seed = 5000)
design2$book
Pin_Elevation <- c(-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1)
Bungee_Position <- c(1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1)
Release_Angle <- c(1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,1,-1,-1)
Ball_Type <- c(1,1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1)
Obs <- c(24,35,21,42,58,41,44,18,47,45,24,53,20,19,23,23)
dat <- data.frame(Pin_Elevation,Bungee_Position,Release_Angle,Ball_Type,Obs)
dat
model <- lm(Obs~Pin_Elevation*Bungee_Position*Release_Angle*Ball_Type,data=dat)
coef(model)
halfnormal(model)
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Bungee_Position, response = dat$Obs, main = "Bungee Position vs Pin Elevation interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Red", "Blue"))
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Release_Angle, response = dat$Obs, main = "Bungee Position vs Release Angle interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Green", "Pink"))
interaction.plot(x.factor = dat$Pin_Elevation, trace.factor = dat$Ball_Type, response = dat$Obs, main = "Bungee Position vs Ball Type interaction", xlab = "Pin Elevation", ylab = "Distance", col = c("Black", "orange"))
Pin_Elevation <- c(-1,1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1)
Bungee_Position <- c(1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1)
Obs <- c(24,35,21,42,58,41,44,18,47,45,24,53,20,19,23,23)
Pin_Elevation <- as.fixed(Pin_Elevation)
Bungee_Position <- as.fixed(Bungee_Position)
dat <- data.frame(Pin_Elevation,Bungee_Position,Obs)
dat
model <- aov(Obs~Pin_Elevation+Bungee_Position,data=dat)
gad(model)