Function to determine required sample size to be within a given margin of error
nsize(b, sigma = NULL, p = 0.5, conf.level = 0.95, type = "mu")
b | the desired bound |
---|---|
sigma | population standard deviation; not required if using type
|
p | estimate for the population proportion of successes; not required
if using type |
conf.level | confidence level for the problem, restricted to lie between zero and one |
type | character string, one of |
Returns required sample size.
Answer is based on a normal approximation when using type "pi".
nsize(b=0.015, p=0.5, conf.level=.95,type="pi")#> #> The required sample size (n) to estimate the population #> proportion of successes with a 0.95 confidence interval #> so that the margin of error is no more than 0.015 is 4269 . #> #># Returns the required sample size (n) to estimate the population # proportion of successes with a 0.95 confidence interval # so that the margin of error is no more than 0.015 when the # estimate of the population propotion of successes is 0.5. # This is Example 8.25 part b. from PASWR. nsize(b=0.02, sigma=0.1,conf.level=.95,type="mu")#> #> The required sample size (n) to estimate the population #> mean with a 0.95 confidence interval so that the margin #> of error is no more than 0.02 is 97 . #> #># Returns the required sample size (n) to estimate the population # mean with a 0.95 confidence interval so that the margin # of error is no more than 0.02. This is Example 8.4 from PASWR.