Determining the sample size for each treatment

library(pwr)
pwr.anova.test(k=3,n=NULL,f=sqrt((.5)^2),sig.level=0.05,power=.75)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 3
##               n = 12.50714
##               f = 0.5
##       sig.level = 0.05
##           power = 0.75
## 
## NOTE: n is number in each group

For this experiment we required 13 samples for 3 different treatment levels.

Layout of Complete Randomized designs

In this experiment, the 3 different treatments are represented by colors yellow, green and blue. the color blue represents the red ball, the color yellow represents the yellow ball and color green represents the green ball that we used in the actual experiment.

library(agricolae)
?design.crd
## starting httpd help server ... done
treatments<-c("green","yellow","blue")
design<-design.crd(trt=treatments,r=13,seed = 12345)
design$book
##    plots  r treatments
## 1    101  1     yellow
## 2    102  1      green
## 3    103  1       blue
## 4    104  2       blue
## 5    105  3       blue
## 6    106  2      green
## 7    107  2     yellow
## 8    108  3     yellow
## 9    109  3      green
## 10   110  4     yellow
## 11   111  5     yellow
## 12   112  4       blue
## 13   113  6     yellow
## 14   114  7     yellow
## 15   115  4      green
## 16   116  5      green
## 17   117  5       blue
## 18   118  6      green
## 19   119  6       blue
## 20   120  8     yellow
## 21   121  7      green
## 22   122  8      green
## 23   123  9     yellow
## 24   124  7       blue
## 25   125  8       blue
## 26   126 10     yellow
## 27   127  9      green
## 28   128 10      green
## 29   129  9       blue
## 30   130 10       blue
## 31   131 11       blue
## 32   132 11      green
## 33   133 12       blue
## 34   134 11     yellow
## 35   135 12     yellow
## 36   136 12      green
## 37   137 13     yellow
## 38   138 13      green
## 39   139 13       blue

Above is a layout of how we collected the samples for each treatment observation. We saved it in a csv file and used github to read the data into R for further analysis.

z <- read.csv("https://raw.githubusercontent.com/Rusty1299/Projects/main/Ball%20Project.csv")
z$Ball <- as.factor(z$Ball)
str(z)
## 'data.frame':    39 obs. of  2 variables:
##  $ Ball            : Factor w/ 3 levels "Blue","Green",..: 3 2 1 1 1 2 3 3 2 3 ...
##  $ Distance.Inches.: int  36 39 36 40 40 47 48 39 38 50 ...

Hypothesis test

Ho: \(\mu_1 = \mu_2 = \mu_3\) - Null Hypothesis

Ha: At least 1 differs - Alternative Hypothesis

Boxplot of the experiment

boxplot(z$Distance.Inches.~z$Ball, col= c("Red","Green","Yellow"), main = "Distance of each ball", xlab = "Treatment balls", ylab = "Distance in inches")

The boxplot reveals that the variation between the red ball, green ball and yellow ball are equal.

Testing normality

qqnorm(z$Distance.Inches.)

The data looks normally distributed with little presence of outliers at the high extreme values of the distance The outliers might be due to excessive force that was applied to the launching process, the ball landing twice , and a misreading of landing position.

Analysis of variance

a <- aov(data = z , Distance.Inches.~Ball)
summary(a)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Ball         2  112.7   56.33   0.783  0.465
## Residuals   36 2589.7   71.94

From the result fo is 0.783 with a corresponding p-value of 0.465 is significantly greater than \(\alpha\) = 0.05. Therefore we fail to reject Ho that the means are equal, and conclude that none of the means are different.

plot(a)

Conclusion

There seems to be nothing unusual about the plots except for the few outliers as the spread of the data looks constant across all treatment balls