aliens <- read.csv ("aliens.csv", header = TRUE, stringsAsFactors = TRUE)
source('special_functions.R')
my_sample <- make.my.sample(33377932, 50, aliens)
library(lsr)

Question 1

t.test(my_sample$intelligence, alternative = "two.sided", mu = 75)
## 
##  One Sample t-test
## 
## data:  my_sample$intelligence
## t = 27.865, df = 49, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 75
## 95 percent confidence interval:
##  106.3438 111.2162
## sample estimates:
## mean of x 
##    108.78

The null hypothesis is that the IQ of residents of Statisticon is equal to 100. The alternative hypothesis is that the IQ of residents of statisticon is not equal to 100.

Question 2

t.test(my_sample$intelligence, alternative = "two.sided", mu = 100)
## 
##  One Sample t-test
## 
## data:  my_sample$intelligence
## t = 7.2425, df = 49, p-value = 2.795e-09
## alternative hypothesis: true mean is not equal to 100
## 95 percent confidence interval:
##  106.3438 111.2162
## sample estimates:
## mean of x 
##    108.78

The value of the t-test statistic is 7.2425. There are 49 degrees of freedom. The p-value is 2.795e-09. We do reject the null because the p-value is less than the significance level. It appears that the alien IQ is higher than human IQ.

Question 3

The null hypothesis mean is inside the confidence interval because aliens have a higher IQ than humans. The confidence interval relates to the p-value because it tells us whether or not the p-value is higher or lower than the significance level which helps up decide whether or not to reject the null hypothesis.

Question 4

t.test(my_sample$anxiety, alternative = "two.sided", mu = 50)
## 
##  One Sample t-test
## 
## data:  my_sample$anxiety
## t = -1.0046, df = 49, p-value = 0.32
## alternative hypothesis: true mean is not equal to 50
## 95 percent confidence interval:
##  48.19974 50.60026
## sample estimates:
## mean of x 
##      49.4

The null hypothesis is that the mean of anxiety in aliens is equal to 50. The alternative hypothesis is that the mean of anxiety in aliens is not equal to 50. The value of t is -1.0046, there are 49 degrees of freedom, and the p-value is 0.32. The null hypothesis is rejected because the p-value is less than the significance level. It appears that the anxiety level of aliens is lower than humans. The null hypothesis mean is outside of the confidence interval.

Question 5

t.test(my_sample$anxiety, alternative = "less", mu = 50)
## 
##  One Sample t-test
## 
## data:  my_sample$anxiety
## t = -1.0046, df = 49, p-value = 0.16
## alternative hypothesis: true mean is less than 50
## 95 percent confidence interval:
##      -Inf 50.40136
## sample estimates:
## mean of x 
##      49.4

The p-value is now half of the one in question 4 after doing a one-sided test.

Question 6

The difference in p-values between questions 4 and 5 might tempt a researcher to use a one-sided test instead of a two-sided test because it is more likely that the null hypothesis will be rejected with a lower p-value. They should not do a one-sided test instead because we are looking for mean and not just one direction of the data such as higher or lower.

Question 7

t.test(my_sample$time1, my_sample$time2, alternative = "two.sided", mu = 0, paired = TRUE)
## 
##  Paired t-test
## 
## data:  my_sample$time1 and my_sample$time2
## t = 8.3468, df = 49, p-value = 5.663e-11
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  0.6020765 0.9839235
## sample estimates:
## mean difference 
##           0.793

The null hypothesis is that the mean of time for aliens to complete a task is equal to 0. The alternative hypothesis is that the mean of time for aliens to complete a task is not equal to 0. The value of t is 8.3468, there are 49 degrees of freedom, and the p-value is 5.663e-11. The null hypothesis is not rejected because the p-value is greater than the significance level. There is a significant difference in the means at 0.793 and it is less than the confidence interval.

Question 8

t.test(my_sample$time2, my_sample$time3, alternative = "two.sided", mu = 0, paired = TRUE)
## 
##  Paired t-test
## 
## data:  my_sample$time2 and my_sample$time3
## t = -0.53557, df = 49, p-value = 0.5947
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -0.3678221  0.2130221
## sample estimates:
## mean difference 
##         -0.0774

The null hypothesis is that the mean of time for aliens to complete a task is equal to 0. The alternative hypothesis is that the mean of time for aliens to complete a task is not equal to 0. The value of t is -0.53557, there are 49 degrees of freedom, and the p-value is 0.5947. The null hypothesis is not rejected because the p-value is greater than the significance level. There is not a significant difference in the means at -.0.0774 and it is less than the confidence interval.

Question 9

I have discovered that there was less of a difference in means between time 2 and time 3 than time 1 and time 2 which means that the aliens learned how to do the task faster.