HWK6 Stats
HWK6 Stats
Allison Kelley
• Submit your homework to Canvas by the due date and time. Email your lecturer if you have
extenuating circumstances and need to request an extension.
• If an exercise asks you to use R, include a copy of all relevant code and output in your submitted
homework file. You can copy/paste your code, take screenshots, or compile your work in an
Rmarkdown document.
• If a problem does not specify how to compute the answer, you many use any appropriate method. I
may ask you to use R or use manual calculations on your exams, so practice accordingly.
• You must include an explanation and/or intermediate calculations for an exercise to be complete.
• Be sure to submit the HWK6 Autograde Quiz which will give you ~20 of your 40 accuracy points.
• 50 points total: 40 points accuracy, and 10 points completion
1
values from of CI were 0.2705 and 0.3096), meaning the true population proportion requiring
towing is above 20%.
c. The club wants to construct a 95% confidence interval for the proportion of members who
want a chocolate fountain at the annual picnic. They want the margin of error to be less
than 0.01. How large of a random sample of club members should they contact if they
start with the assumption that 50% are in favor of a chocolate fountain at the picnic?
(Hint: write out the formula for margin of error, then solve for n)
2
(i) Compute the t test statistic and pvalue by hand (not using t.test) and then
confirm the values using t.test.
T =( xbar-mu0)/(sd/sqrt(n))
(13.248-12)/(3.138/sqrt(31))
1.28/0.5636 = 2.214 = t-test statistic
p-value = 0.0346
The p-value of 0.0346 < 0.05, or is very small, so there is enough evidence against the null hypothesis,
meaning we can reject it. The value 12 is not contained.
(iii) Compare the conclusions drawn from the 90% confidence interval for µD in home-
work 5, exercise 2(b) and the hypothesis test in the previous question.
Much like the example above, I would reject the null hypothesis, as 12 is outside of its
confidence interval of (12.307, 14.193).
The p value of 0.389 is greater than alpha, meaning the 90% confidence interval contains the value of 77, so
we fail to reject the null hypothesis.
(iii) Compare the conclusions drawn from the 90% confidence interval for µH in
home- work 5, exercise 2(b) and the hypothesis test in the previous question.
These conclusions are similar to the one in the previous homework. The values from the
question above include a p value test, which tells us the probability of getting an extreme
result from the data, assuming the null hypothesis is true. The mean diameter is close to 77,
and is included in the 90% CI.
3
c. The code below calculates the lower and upper critical values needed for a 90% bootstrap
confidence interval for µD (mean diameter). Do not edit this code - just run the chunk and
read off the output.
n <- 31
x_bar <- mean(trees$Girth)
set.seed(371)
# Bootstrap loop
for(i in 1:1000){
# 2. Draw a SRS of size n from data
x_star <- sample(trees$Girth, size = n, replace = T)
## [1] -1.690054
quantile(t_hat, probs = 0.95, names = F)
## [1] 1.523721
Use these critical values to construct a 90% bootstrap t confidence interval for µD
(mean diameter) from the sample data in the trees data set. Compare this confidence
interval to the regular t CI constructed in homework 5, 2(b) and brainstorm possible
reasons for the relationships you noticed.