# nsize: Required Sample Size In PASWR2: Probability and Statistics with R, Second Edition

## Description

Function to determine required sample size to be within a given margin of error

## Usage

 `1` ```nsize(b, sigma = NULL, p = 0.5, conf.level = 0.95, type = c("mu", "pi")) ```

## Arguments

 `b` the desired bound `sigma` population standard deviation; not required if using type `"pi"` `p` estimate for the population proportion of successes; not required if using type `"mu"` `conf.level` confidence level for the problem, restricted to lie between zero and one `type` character string, one of `"mu"` or `"pi"`, or just the initial letter of each, indicating the appropriate parameter; default value is `"mu"`

## Details

Answer is based on a normal approximation when using type `"pi"`.

## Author(s)

Alan T. Arnholt <arnholtat@appstate.edu>

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```nsize(b = 0.015, p = 0.5, conf.level = 0.95, type = "pi") # 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. nsize(b = 0.02, sigma = 0.1, conf.level = 0.95, type = "mu") # 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. ```

PASWR2 documentation built on Sept. 5, 2021, 5:44 p.m.