Load in data
deer = read.csv("Deer.csv")
iris = read.csv("iris.csv")
Task 1, Make up a vector of 50 random Legolas actors, with mean height of 195cm, and a standard deviation of 15cm. Run a t-test to compare this sample of actors to the set of Aragorns and then the set of Gimlis. Do you find evidence for significant differences?
legolas = rnorm(50, mean=195, sd=15)
aragorn = rnorm(50, mean=180, sd=10)
gimli = rnorm(50, mean=132, sd=15)
t.test(legolas, aragorn, alternative="two.sided")
##
## Welch Two Sample t-test
##
## data: legolas and aragorn
## t = 4.2586, df = 93.175, p-value = 4.907e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 6.099234 16.756692
## sample estimates:
## mean of x mean of y
## 192.4947 181.0667
t.test(legolas, gimli, alternative="two.sided")
##
## Welch Two Sample t-test
##
## data: legolas and gimli
## t = 20.992, df = 97.985, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 56.16865 67.89712
## sample estimates:
## mean of x mean of y
## 192.4947 130.4618
With such low p-values for both above t-tests I can confidently reject the null for the alternate hypothesis that the is a significant height difference between the actors for Legolas and Aragorn as well as between Legolas and Gimli.
Task 2, Re-run the variance test (F-test) to compare the group of Gimli and Legolas actors. Do these groups have different variance?
var.test(gimli, legolas)
##
## F test to compare two variances
##
## data: gimli and legolas
## F = 0.9757, num df = 49, denom df = 49, p-value = 0.9317
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.553686 1.719366
## sample estimates:
## ratio of variances
## 0.975699
With such a high p-value, I cannot reject the null hypothesis that there is not significant difference between the height of the two groups.