In: Math
Using Rcode solve
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 and sample standard deviation is 4.83 mpg.
a. Which kind of confidence interval is appropriate to use here, z-interval or t-interval?
b. What are the assumptions to check for the interval you chose?
c. Please use R to find the critical value the company needs when constructing a (two-sided) 98% CI.
d. Please use R to construct a (two-sided) 98% CI for the mean of the general gasoline usage.
e. Please use R to construct a 98% upper confidence bound for the mean of the general gasoline usage.
f. Create a R function whose argument is the width of CI, and the output is the sample size necessary to achieve such accuracy. The confidence level is fixed at 98%.
g. Apply the function you created in part (f) to demonstrate that larger sample size is required to achieve better accuracy (i.e, narrower CI width). Confidence level is fixed at 98%. Show at least three examples
SolutionA:
since population standard deviation is not gievn use Z interval.
since sample standard deviation is given use t interval
SolutionB:
distribution to be normal
sample is simple random sample
here n=50
n>30
according to centarl limit theorem follows normal distribution
c. Please use R to find the critical value the company needs when constructing a (two-sided) 98% CI.
n <- 50
criticalt <- qt(0.98,df=n-1)
2.109873
CRITICAL T =2.109873
d. Please use R to construct a (two-sided) 98% CI for the mean of the general gasoline usage.
Rcode:
xbar <- 25.02
s <- 4.83
n <- 50
margn_of_error <-qt(0.98,df=n-1)*s/sqrt(n)
lowerlimit <- xbar-margn_of_error
lowerlimit
upperlimit <- xbar+margn_of_error
upperlimit
lowerlimit
23.57882
upperlimit:
26.46118
98% confidence interval for true mean lies in between 23.57882 and 26.46118
Solutione:
e. Please use R to construct a 98% upper confidence bound for the mean of the general gasoline usage.
upperlimit <- xbar+margn_of_error
upperlimit
26.46118