In: Statistics and Probability
(a) Using the armspanSpring2020.csv data from class, test the hypothesis that those who identify as female have a shorter armspan than those who do not so identify. Write out the null and alternative hypotheses, give the value of the test statistic and the p-value, and state your conclusion using a 5% significance level. Use R for all computations.
(b) Interpret, in your own words, the meaning of the p-value you got in part (a).
(c) Find a 95% confidence interval for the mean armspan using
the data in armspanSpring2020.csv. Use R.
(d) What assumptions must you make if we wish to interpret this
interval to apply to all UCLA students? Which of these assumptions
do you think are met adn which are not?
(e) Find a 95% confidence interval for the difference between mean
armspan and mean heights. Does it contain 0? Why is this surprising
or not-surprising?
height | armspan | is.female |
67 | NA | 1 |
70 | 40 | 0 |
64 | 67 | 1 |
71 | 70 | 0 |
72 | 49 | 0 |
62 | 61 | 1 |
72 | 74 | 0 |
71 | 68 | 0 |
63 | 60 | 1 |
69 | 69 | 0 |
67 | 68 | 1 |
63 | 63 | 1 |
60 | 60 | 1 |
66 | 66 | 0 |
61 | 61 | 1 |
69 | 68 | 0 |
65 | 65 | 1 |
72 | 72 | 0 |
70 | 70 | 0 |
73 | 77 | 0 |
65 | 61 | 1 |
68 | 72 | 1 |
62 | 55 | NA |
71 | 74 | 0 |
72 | 70 | 0 |
66 | 22 | 1 |
65 | 67 | 1 |
64 | 62 | 0 |
65 | 62 | 1 |
73 | 69 | 0 |
67 | 77 | 0 |
60 | 62 | 1 |
70 | 59 | 0 |
68 | 66 | 1 |
65 | 65 | 1 |
72 | 69 | 0 |
62 | 52 | 1 |
69 | 66 | 0 |
68 | 67 | 0 |
65 | 66 | 1 |
65 | 64 | 0 |
66 | 65 | 1 |
62 | 52 | 1 |
64 | 62 | 1 |
66 | 65 | 1 |
69 | 69 | 0 |
64 | 65 | 1 |
70 | 74 | 0 |
65 | 69 | 0 |
70 | 80 | 0 |
63 | NA | 1 |
67 | 70 | 1 |
64 | 64 | 1 |
64 | 62 | 1 |
6 | 5.7 | 0 |
67 | 67 | 1 |
72 | 71 | 0 |
73 | 75 | 0 |
68 | 68 | 0 |
67 | 63 | 1 |
66 | 67 | 1 |
67 | 36 | 0 |
68 | 72 | 0 |
73 | 70 | 0 |
70 | 70 | 0 |
70 | 72 | 0 |
60 | 58 | 0 |
70 | 68 | 0 |
62 | 63 | 0 |
68 | 68 | 1 |
67 | 67 | NA |
68 | 71 | 0 |
65 | 48 | 1 |
70 | 76 | 0 |
69 | 70 | 0 |
69 | 66 | 0 |
58 | 55 | NA |
64 | 64 | 0 |
Please help with the r codes especially. It is my first time using it and I'm having a hard time. Thanks!
data <- read.table("../Documents/Tutoring/Software/random
data/armspanSpring2020.csv",header =T)
#a
female_arm <- data[which(data$is.female==1& data$armspan !=
"NA"),"armspan"]
male_arm <- data[which(data$is.female==0 & data$armspan !=
"NA"),"armspan"]
t.test(female_arm,male_arm,alternative="less")
#c
t.test(data$armspan)
Ho : mu_female = mu_male
Ha: mu_female < mu_male
TS = -1.5743
p-value = 0.05993
p-value > alpha (0.05)
hence we fail to reject the null hypothesis
b)
p-value is 0.05993
it means the probability of getting more extreme than this sample
is 0.05993 when means are equal
c)
95% confidence interval is (61.38928,66.57651)