Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please do this in Rstudio (R code). A company with a large fleet of cars wants t

ID: 3235032 • Letter: P

Question

Please do this in Rstudio (R code).

A company with a large fleet of cars wants to study the gasoline usage. They check the gasoline usage for 50 company trips chosen at random, finding a mean of 25.02 mpg. Based on the past experience, they believe that the gasoline usage is normally distributed and the standard deviation of the general gasoline usage is 4.83 mpg. (a) Which kind of confidence intervals is appropriate to use here, interval or t-interval? (b) Please use R to find the critical value they need when constructing a 95% CI. (c) Please use R to construct a 95% CI for the mean of the general gasoline usage. (d) If they want to control the width of CI to be within 0.8 mpg, at least how many trips do they have to sample? Use R to calculate. (e) Create a R function whose argument is the width of CI, and the output is the sample size necessary to achieve such accuracy. Confidence level is fixed at 95% (f) Apply the function you created in part (e) to demonstrate that larger sample size is required to achieve better accuracy (i.e, narrower CI width). Confidence level is fixed at 95%.

Explanation / Answer

Solution: As per answer guidelines and chegg policy, I am providing here the solution of 4 subparts (a), (b), (c) and (d) only.

As the sample size is 50 , which is greater than 30 we can go for a z test , had it been less than 30 then we would have conducted a t test

Please find the detailed R - snippet for for subparts from (a) to (d)

m<-25.02
s<- 4.83
n<-50

# the critical value is
qnorm(0.975)

# CI with 95% confidence
error <- qnorm(0.975)*s/sqrt(n)
left <- m-error
right <- m+error
left
right

# lets calculate right - left and say it is width

#width = 2*error
#now we want width to be 0.8 and calculate n
#0.8 = qnorm(0.975)*s/sqrt(n)

sqrt.n <- qnorm(0.975)*s/ 0.8
n<- sqrt.n^2
round(n)