`library(whSample)`

The ** ssize** function is part of the

This approximation to the hypergeometric distribution spans the probabilities of yes/no-type responses without replacement. Its parameters are:

**N**, the population size.**ci**, the required confidence interval. The default is 95%.**me**, the required level of precision, or margin of error. The default is +/- 7%.**p**, the anticipated rate of occurrence. The default is 50%.

** ssize** requires only the

The full range of command-line options is:

`ssize(N, ci=0.95, me=0.07, p=0.5)`

After loading the ** whSample** package,

```
ssize(10000)
#> [1] 193
```

This says a random sample of 193 of the 10,000 items in the population is estimated to be the minimum necessary to satisfy a ** confidence level** of

The parameter most likely to change is the *anticipated rate of occurrence*. Many sampling situations provide opportunities to update the rate of occurrence during the sampling process. Let’s say that after a reasonable number of sample tests (somewhere in excess of 30 or 50), we find the rate of occurrence of the item we’re testing shows “positives” in 60 percent of the trials. If the conduct of a single trial is expensive in resources, we may want to re-estimate the necessary sample size:

```
ssize(10000, p=0.6)
#> [1] 185
```

A new target of 185 would save eight trials. Since the goal of sampling is to get the most reliable results using the least amount of resources, this may be nice. Three words of caution come to mind:

- More samples mean more reliable results.
- Continuing to test toward the new 185 target may show the true rate of occurrence may be higher or lower, so continuing to check periodically may be a good idea.
- Sample size estimators do only that: they
. Only post-sampling analysis can confirm if the*estimate*and*confidence*requirements were actually achieved.*precision*