5.13 Car insurance savings.

A market researcher wants to evaluate car insurance savings at a competing company. Based on past studies he is assuming that the standard deviation of savings is $100. He wants to collect data such that he can get a margin of error of no more than $10 at a 95% confidence level. How large of a sample should he collect?

#we are given
sd<-100
#margin of error <= 10
#confinence interval is 95%
#caluculate significance level α that shows the probability of making the wrong decision
alpha <-1-0.95
alpha
## [1] 0.05

We are asked to find the minimum sample size that returns a margin of error of no more than $10 at a 95% confidence level.

A margin of error tells how many points (or percentage points) your results will differ from the true population mean.

In our case, a 95% confidence interval with a 10 points margin of error means that our statistic will be within 10 points of the true population mean 95% of the time.

Margin of error = z * SE

z * SE <= 10

z = 1.96

pop_mean<-0
se<-1

#bulding standard normal distribution curve for a population
visualize.norm(stat=c(-1.96,1.96),mu=pop_mean,sd=se,section="bounded")

Z<-qnorm(alpha/2, mean=0, sd=sd,lower.tail=F)/100
Z
## [1] 1.959964

1.96 * SE <= 10

SE = SD/sqrt(n)

1.96 * SD/sqrt(n) <= 10

n <-(1.96*sd/10)^2
round(n,0)
## [1] 384
n <-(Z*sd/10)^2
round(n,0)
## [1] 384

In order to receive a margin of error of no more than $10 at a 95% confidence level the minimum sample size is 384 (equal or greater than 384)