library(mosaic)library(DT)library(pander)library(car)library(tidyverse)library(lattice)library(dplyr)library(ggplot2)library(knitr)# Record your data from your own mini experiment in Excel.# Save the data as a .csv file in the Data folder of the Statistics-Notebook.balloon <-read_csv("../../data/BalloonsTwoFactorData.csv")
We randomized our data. Each balloon was dropped from the Ricks Stairs 5 times bringing a total of 30 drops from our 6 balloons.
Our Two Factors are 3 balloons blown up with 5 breaths of air and 3 balloons blown up with 2 breaths (less air). One of each balloon was weighted either with no weight, a penny taped to the bottom or a quarter taped to the bottom making this a 2 by 3 design. There are 6 total factor combinations. Thus the second factor is weight, nothing, penny, or quarter.
Stephanie dropped all of the balloons from the balcony and Cali and I each had a stop watch at the bottom. We started the time when Stephanie let go of the balloon and stopped the time when any part of the balloon touched the ground. The y variable is the average of the two stop watch times.
The ANOVA test tells us that there is significance in comparing the 3 groups and then the interaction between the groups. We see that weight and airmass are significant on their own and the interaction is significant. We need to take a closer look to actually see that difference. We will run some graphs and then a post hoc comparison test to see which groups are different and more different than the others.
Weight Graph
Show the code
## lets go a ggplot that's real sexy likelibrary(ggplot2)library(dplyr)ggplot(balloon, aes(x=weight, y=avgtime)) +geom_boxplot(aes(fill = weight)) +theme_bw() +scale_fill_manual(values =c("cadetblue1", "brown", "gray")) +labs(title ="Time That Balloon Takes to Get to the Floor in Seconds ",fill ="Weighted Measure",x ="Weights",y ="Distance to Floor (seconds)")
Just looking at the nothing weight category we can see that the average is so much greater than the other two weights. The quarter is even greater than the penny but we will have to run comparisons to see the difference.
Air Mass Graph
Show the code
## lets go a ggplot that's real sexy likelibrary(ggplot2)library(dplyr)ggplot(balloon, aes(x=airmass, y=avgtime)) +geom_boxplot(aes(fill = airmass)) +theme_bw() +scale_fill_manual(values =c("skyblue2", "chartreuse3")) +labs(title ="Time That Balloon Takes to Get to the Floor in Seconds ",fill ="Air Mass",x ="Air Mass",y ="Distance to Floor (seconds)")
The graphs are displaying the significant difference we saw in the anova test for air mass. The colors represent the color of balloons that we dropped.
This numerical summary is showing a 0.7 second difference between the large and small balloons. When the max is only 3.14 seconds for large that 60th of a second is a big difference as shown to be significant in the anova test.
Interaction Graph
Show the code
xyplot(as.numeric(avgtime) ~as.factor(weight), data = balloon, groups=airmass, type=c("p","a"), auto.key=TRUE, main="How Weight and Airmass Affect Balloon Drop Rate", ylab="Distance to Drop (Seconds)", xlab="Weight")
This is so cool. I love that we see the most variation in the Large Quarter stdev = 0.081 and see the least in the small quarter stdev = 0.009. Obviously the large nothing is much greater than the small quarter.
Again like the numerical summary, the nerd in me is so excited. This shows that none of the balloons are the same as the others. I want to run another scheffe that shows the a, b, cs to check.
Study: balloon.aov2 ~ "Group"
Scheffe Test for avgtime
Mean Square Error : 0.003602083
Group, means
avgtime std r se Min Max Q25 Q50 Q75
Large.Nothing 3.042 0.064284524 5 0.02684058 2.990 3.140 3.000 3.005 3.075
Large.Penny 2.187 0.056413651 5 0.02684058 2.125 2.270 2.160 2.165 2.215
Large.Quarter 1.848 0.080978392 5 0.02684058 1.745 1.930 1.805 1.830 1.930
Small.Nothing 2.244 0.071624018 5 0.02684058 2.185 2.365 2.205 2.215 2.250
Small.Penny 1.581 0.050299105 5 0.02684058 1.530 1.640 1.550 1.555 1.630
Small.Quarter 1.214 0.008944272 5 0.02684058 1.205 1.225 1.205 1.215 1.220
Alpha: 0.05 ; DF Error: 24
Critical Value of F: 2.620654
Minimum Significant Difference: 0.1374032
Means with the same letter are not significantly different.
avgtime groups
Large.Nothing 3.042 a
Small.Nothing 2.244 b
Large.Penny 2.187 b
Large.Quarter 1.848 c
Small.Penny 1.581 d
Small.Quarter 1.214 e
Wait this is crazy, small nothing is not different than large penny. Their means are 2.165 (large penny) and 2.215 (small nothing). That is only a .05 of a second difference. I need to take a closer look. Let me run another comparison to check closer.
contrast estimate SE df t.ratio p.value
SmallNothingvsLargePenny 0.057 0.038 24 1.502 0.1462
P value adjustment: scheffe method with rank 1
The p-value is not significant! This is the finding I was looking for. With 6 distinctive balloons it’s almost more interesting to find that one or more of the groups are not significant with each other. So cool to see.
contrast estimate SE df t.ratio p.value
NothingvsOthers 0.935 0.0232 24 40.246 <0.0001
PennyvsOthers -0.203 0.0232 24 -8.733 <0.0001
QuartervsOthers -0.733 0.0232 24 -31.513 <0.0001
Results are averaged over the levels of: airmass
P value adjustment: scheffe method with rank 2
This shows that each group is unique but that’s not that interesting to me. I want to directly compare penny and quarter times since they were closer than the nothing group. I am going to run another contrast.
contrast estimate SE df t.ratio p.value
PennyvsQuarter 0.353 0.0268 24 13.152 <0.0001
Results are averaged over the levels of: airmass
P value adjustment: scheffe method with rank 1
Still very significant. Nice I like it.
There is no reason for me to run a contrast for Air Mass since that factor only has 2 levels unlike the weight that has 3.
(I ran all the different post hocs and didn’t want to straight up delete them)
Pairwise comparisons using t tests with pooled SD
data: balloon$avgtime and balloon$weight
Nothing Penny
Penny 7.9e-05 -
Quarter 2.6e-07 0.04
P value adjustment method: none
Pairwise comparisons using t tests with pooled SD
data: balloon$avgtime and balloon$weight
Nothing Penny
Penny 0.00024 -
Quarter 7.8e-07 0.11913
P value adjustment method: bonferroni
In this Tukey chart we see that none of the groups overlap on the 0 line so they are all different from eachother. I chose the Tukey test because I want to keep my Type 1 error low. I also want to see the confidence intervals.
Study: balloon.aov ~ "weight"
Scheffe Test for avgtime
Mean Square Error : 0.003602083
weight, means
avgtime std r se Min Max Q25 Q50 Q75
Nothing 2.643 0.4254488 10 0.01897916 2.185 3.14 2.22375 2.6775 3.00375
Penny 1.884 0.3233402 10 0.01897916 1.530 2.27 1.57375 1.8825 2.16375
Quarter 1.531 0.3385328 10 0.01897916 1.205 1.93 1.21625 1.4850 1.82375
Alpha: 0.05 ; DF Error: 24
Critical Value of F: 3.402826
Minimum Significant Difference: 0.07002075
Means with the same letter are not significantly different.
avgtime groups
Nothing 2.643 a
Penny 1.884 b
Quarter 1.531 c
Interpretation
It would appear that each balloon is different but when I ran and interaction Sheffé test on the individual balloons I found that Small Nothing and Large Penny were not found to be different than each other. This is very interesting data because it felt like each balloon was totally different. This is the most interesting finding in this analysis. p-value = .1462 > \alpha
All other interaction groups were significantly different than each other. p-value = 0.001 < \alpha