Description Usage Arguments Details Author(s) References See Also Examples

View source: R/binomTestCoverage.R

Calculates the actual coverage of a confidence interval for a
binomial proportion for a particular sample size *n* and
a particular value of the probability of success *p* for several
confidence interval procedures.

1 2 3 | ```
binomTestCoverage(n, p,
alpha = 0.05,
intervalType = "Clopper-Pearson")
``` |

`n` |
sample size |

`p` |
population probability of success |

`alpha` |
significance level for confidence interval |

`intervalType` |
type of confidence interval used; either "Clopper-Pearson", "Wald", "Wilson-Score", "Jeffreys", "Agresti-Coull", "Arcsine", or "Blaker" |

Calculates the actual coverage of a confidence interval
procedure at a particular value of *p* for

various types of confidence intervals,

various probabilities of success

*p*, andvarious sample sizes

*n*.

The actual coverage for a particular value of *p*, the probability of success of interest, is

*c(p) = ∑_{x=0}^n {I(x,p) {n \choose x} p^x (1-p)^{n-x}},*

where *I(x,p)* is an indicator function that determines whether a confidence interval
covers *p* when *X = x* (see Vollset, 1993).

The binomial distribution with arguments `size`

= *n* and
`prob`

= *p* has probability mass function

*
p(x) = choose(n, x) p^x (1-p)^(n-x)*

for *x = 0, 1, 2, …, n*.

The algorithm for computing the actual coverage for a particular probability of
success begins by calculating all possible lower and upper bounds associated
with the confidence interval procedure specified by the `intervalType`

argument.
The appropriate binomial probabilities are summed to determine the actual coverage
at *p*.

Hayeon Park (hpark03@email.wm.edu), Larry Leemis (leemis@math.wm.edu)

Vollset, S.E. (1993). Confidence Intervals for a Binomial Proportion. Statistics in Medicine, 12, 809-824.

1 2 | ```
binomTestCoverage(6, 0.4)
binomTestCoverage(n = 10, p = 0.3, alpha = 0.01, intervalType = "Wilson-Score")
``` |

```
[1] 0.995904
[1] 0.9894079
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.