Learn R Programming

ufs (version 0.5.12)

pwr.confIntProp: Estimate required sample size for accuracy in parameter estimation of a proportion

Description

This function uses confIntProp() to compute the required sample size for estimating a proportion with a given accuracy.

Usage

pwr.confIntProp(prop, conf.level = 0.95, w = 0.1, silent = TRUE)

Value

A single numeric value (the sample size).

Arguments

prop

The proportion you expect to find, or a vector of proportions to enable easy sensitivity analyses.

conf.level

The confidence level of the desired confidence interval.

w

The desired 'halfwidth' of the confidence interval.

silent

Whether to provide a lot of information about progress ('FALSE') or not ('TRUE').

Examples

Run this code
### Required sample size to estimate a prevalence of .03 in the
### population with a confidence interval of a maximum half-width of .01
pwr.confIntProp(.03, w=.01);

### Vectorized over prop, so you can easily see how the required sample
### size varies as a function of the proportion
pwr.confIntProp(c(.03, .05, .10), w=.01);

Run the code above in your browser using DataLab