** Hwk-5.13_Chapter-5_Inference_Daniel_Thonn **

This Assignment requires the following:

1). R-Studio 2). R

Packages are used as shown in the Packages section

Setting up and Preparing the Environment

Packages Section Install the packages required

#Prepatory and Package installations

#install.packages(c('openintro','OIdata','devtools','ggplot2','psych','reshape2',
#                  'knitr','markdown','shiny'))
#install.packages("devtools")
#devtools::install_github("jbryer/DATA606")

#require(knitr)

#library(ggplot2)
#library(utils)

# install.packages('dplyr')
#library(dplyr)

# install.packages('DATA606')
# library(DATA606)

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?

Problem Summary:

Find sample size = n

ME (Margin of Error) <= 10 CI (Confidence Interval) = 95% sd (standard deviation) = 100

Formulas: ME = z* x SE

For 95% > Z* = 1.96 sd

SE = sd / ((n)^.5)

Therefore:

ME = z* x SE

SE = ME/z*

sd / ((n)^.5) = ME/z*

((n)^.5) = sd/ME/Z*

n = (sd/ME/Z*)^2

n = (100/10/1.96)^2

# ME = = z* x SE

#n <- (100/10/1.96)^2
n <- 19.6^2

# For ME <=10, then n gets larger
round(n,2) 
## [1] 384.16
#Ans: For ME <= 10 then n (sample size) >= 384.16 >= 385 

END