4) We're going to test the same hypothesis four ways. Assume thepeople in the dataset in armspanSpring2020.csv are a random sampleof all adults. For each test, report the test statistic and thep-value. With a 5% significance level, give the conclusion of eachtest.
a) Test the hypothesis that the mean difference between armspan andheight it not equal to 0, using the data in armspanSpring2020.csv.Do this by creating a new variable named diff = (armspan - height).Perform a one-sample t-test.
b) Test the same hypothesis, but use a two-sample t-test withpaired =TRUE.
c) Test the same hypothesis, but use a two-sample t-test withpaired=FALSE and var.equal=FALSE.
d) Test the same hypothesis, but use a two-sample t-test withpaired=FALSE and var.equal=TRUE.
e) Which test(s) do you think are valid for this situation andwhy? Â
hint: We almost never use the var.equal=TRUE test. Why? Because itis only valid if the population standard deviations of bothpopulations are equal. You might be in a situation where you knowthis to be true. If so, fine, use it. But usually we don't, inwhich case (a) the var.equal=FALSE test will provide more accuratep-values if the standard deviations are not equal and (b) willprovide pretty accurate p-value if they are. So you can't lose,really, with the var.equal=FALSE test, but you can lose with it theother way.
g)Data cleaning. Identify by row number which observations seemin need of cleaning and why you think so. Provide a table. (Hint:consider the \"which()\" and \"identify()\" functions.) Provide a graphto justify your identifications.
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. It is my first time doing r studioand I'm having a hard time. Thanks!