Homework 1 Note: You must provide necessary R code with your answers. You will not receive any credit if
you don’t show the code for the part you are answering.
1. (24 total points) In a study conducted by the Pew Research Center for the 2016 election,
1068 out of 3956 people (27%) with at least a college degree identified themselves as
Republican while 1235 out of 4117 people (30%) without a college degree (i.e. some
college or less) identified themselves as Republican. Is there a difference in whether
people identify themselves as Republican between college graduates and non-college
graduates?
(a) (2 points) Identify the explanatory and response variables.
Explanatory:
Response:
(b) (2 points) Fill in the two-way contingency table
College Degree No College Degree Total
Republican
Non-Republican
Total
(c) (10 points) Conduct a formal hypothesis test using = 0.05. That means (1) write the
hypotheses, (2) calculate the test statistic, (3) state your decision by comparing the
test statistic to the appropriate critical value, and (4) give a conclusion.
(d) (1 point) Obtain the p-value for the test statistic. You can use the Two
Proportion Test code posted on Canvas to obtain the p-value.
(e) (2 points) Use Fisher’s Exact Test in RStudio to get the p-value. Explain if the p-
value from Fisher’s Exact Test is similar to the p-value obtained above.
(f) (3 points) Calculate a 95% confidence interval. Make sure to show work.
(g) (4 points) Interpret the 95% confidence interval.
2. (23 total points) Use the Lifespan file posted under Chapter 1 Homework on Canvas
to conduct an analysis to see if men who have children have a different lifespan than men
who don’t.
(a) (2 points) Explain which test statistic (i.e. or ) should be used.
(b) (3 points) Record the mean, standard deviation, and sample size in the boxes below.
You can read in the data file into R using the code below if the file is saved into your
Documents => Stat 318 folder. Note that you’ll have to make changes to the
code below if you save the data file into a different folder.
For Windows:
lifespan Stat 318 folder. Note that you’ll have to make changes to the
code below if you save the data file into a different folder.
For Windows:
baseball <-read.csv(file="~/Stat 318/Baseball Angles Data.csv")
For Macs:
baseball <-read.csv(file="~/Documents/Stat 318/Baseball Angles
Data.csv")
Mean Difference:
SD:
(c) (10 points) Conduct a formal hypothesis test using = 0.05. That means (1) write the
hypotheses, (2) calculate the test statistic, (3) state your decision by comparing the
test statistic to the appropriate critical value, and (4) give a conclusion. In your
conclusion, be sure to state which angle is better (i.e. faster) if there’s a significant
difference.
(d) (1 point) Provide the 95% confidence interval.
(e) (4 points) Interpret the 95% confidence interval.
4. (2 points) Why does increasing the confidence level widen the confidence interval?
5. (3 points) Why is a confidence interval often preferred to a hypothesis test?