Please do this in Rstudio (R code). In a class survey, students are asked how ma
ID: 3249748 • Letter: P
Question
Please do this in Rstudio (R code).
In a class survey, students are asked how many hours they sleep per night. In the sample of 22 students, the mean was 5.77 hours with a standard deviation of 1.572 hours. The parameter of interest is the mean number of hours slept per night in the population from which this sample was drawn. (a) Which kind of confidence intervals is appropriate to use here, z-interval or t-interval? (b) Please use R to find the critical value they need when constructing a 98% CI. (c) Please use R to construct a 98% CI for the mean number of hours slept per night. (d) Please use R to construct a 98% lower confidence bound for the mean number of hours slept per night.Explanation / Answer
Answer:
a). t interval
b).
R code:
n <- 22
t<- qt(0.99,df=n-1)
t
[1] 2.517648
c).
R code:
# 98% CI for mean
a <- 5.77
s <- 1.572
n <- 22
error <- qt(0.99,df=n-1)*s/sqrt(n)
left <- a-error
right <- a+error
left
right
R output:
[1] 4.926206
> right
[1] 6.613794
98% CI = (4.926206, 6.613794)
d).
R code:
# 98% lower CI for mean
a <- 5.77
s <- 1.572
n <- 22
error <- qt(0.98,df=n-1)*s/sqrt(n)
left <- a-error
left
R output:
5.03621
98% lower bound= 5.03621
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.