aliens <- read.csv ("aliens.csv", header = TRUE, stringsAsFactors = TRUE)
source('special_functions.R')
my_sample <- make.my.sample(33002176, 100, aliens)
## Warning in RNGkind("Mersenne-Twister", "Inversion", "Rounding"): non-uniform
## 'Rounding' sampler used
library(lsr)
library(sciplot)

Question 1

bargraph.CI(x.factor = my_sample$island,
            response = my_sample$control,
            ci.fun = ciMean, ylim = c(0, 100),
            legend = T)

bargraph.CI(x.factor = my_sample$college,
            response = my_sample$control,
            ci.fun = ciMean, ylim = c(0, 100),
            legend = T)

Based on the graphs, I do not think intelligence differs between islands and I do not think intelligence differs between colleges? I really do not see any differences among the islands or colleges in the topic of intelligence.

Question 2

cp.anova <- aov(my_sample$control ~ my_sample$island)
summary(cp.anova)
##                  Df Sum Sq Mean Sq F value Pr(>F)
## my_sample$island  2    353  176.49   1.827  0.166
## Residuals        97   9371   96.61
cp.anova <- aov(my_sample$control ~ my_sample$college)
summary(cp.anova)
##                   Df Sum Sq Mean Sq F value Pr(>F)
## my_sample$college  3    458  152.55    1.58  0.199
## Residuals         96   9267   96.53

The Df different between the two analyses are 2 for island and 3 for colleges. The p-value in each case is 0.146 for islands and 0.644 for colleges. The null hypothesis in each case is there is no difference in means and because there is a difference in means I choose to reject the null hypothesis.

Question 3

TukeyHSD(cp.anova)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = my_sample$control ~ my_sample$college)
## 
## $`my_sample$college`
##                         diff        lwr       upr     p adj
## Europa-Callisto   -1.8066667  -8.763063  5.149730 0.9048137
## Ganymede-Callisto -5.5380952 -12.288161  1.211970 0.1464020
## Io-Callisto       -2.2607843 -10.059040  5.537471 0.8730226
## Ganymede-Europa   -3.7314286 -10.799852  3.336995 0.5147432
## Io-Europa         -0.4541176  -8.529513  7.621278 0.9988590
## Io-Ganymede        3.2773109  -4.621040 11.175661 0.6995706

After interpreting these results, it is shown that the aliens from Io who attend Ganymede have the most significant difference from the rest of the islands and colleges.

Question 4

bargraph.CI(x.factor = my_sample$antennae,
            group = my_sample$color,
            response = my_sample$food1,
            ci.fun = ciMean, ylim = c(0, 20),
            legend = T)

The patterns I see in this graph show no significant difference in the consumption of food based on antennae and color.

Question 5

sci.anova <- aov(my_sample$food1 ~ my_sample$color*my_sample$antennae)
summary(sci.anova)
##                                    Df Sum Sq Mean Sq F value Pr(>F)  
## my_sample$color                     1   28.0  28.025   6.677 0.0113 *
## my_sample$antennae                  1    2.8   2.843   0.677 0.4125  
## my_sample$color:my_sample$antennae  1   19.0  18.956   4.516 0.0361 *
## Residuals                          96  402.9   4.197                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The Df in each row is 1. This proves these three factors do not seem to have much effect on one another. The null hypotheses is that in each case is there is no difference in means and because there is a difference in means I choose to reject the null hypothesis.

Question 6

bargraph.CI(x.factor = my_sample$college,
            group = my_sample$politics,
            response = my_sample$intelligence,
            ci.fun = ciMean, ylim = c(0, 300),
            legend = T)

sci.anova <- aov(my_sample$intelligence ~ my_sample$college*my_sample$politics)
summary(sci.anova)
##                                      Df Sum Sq Mean Sq F value Pr(>F)    
## my_sample$college                     3   5015  1671.6  48.392 <2e-16 ***
## my_sample$politics                    2    108    54.0   1.563 0.2152    
## my_sample$college:my_sample$politics  6    464    77.4   2.240 0.0466 *  
## Residuals                            88   3040    34.5                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The degrees of freedom in the ANOVA table seem to be different for each category.The null hypotheses is that in each case is there is no difference in means and because there is a difference in means I choose to reject the null hypothesis.