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

Uses one of three methods to compute a confidence interval for the probability of success (p) in a binomial distribution.

1 2 3 4 5 6 7 |

`x` |
A single or vector of numbers that contains the number of observed successes. |

`n` |
A single or vector of numbers that contains the sample size. |

`conf.level` |
A single number that indicates the level of confidence (default is |

`type` |
A string that identifies the type of method to use for the calculations. See details. |

`verbose` |
A logical that indicates whether |

This function will compute confidence interval for three possible methods chosen with the `type`

argument.

`type="wilson"` | Wilson's (Journal of the American Statistical Association, 1927) confidence interval for a proportion. This is the score CI, based on inverting the asymptotic normal test using the null standard error. |

`type="exact"` | Computes the Clopper/Pearson exact CI for a binomial success probability. |

`type="asymptotic"` | This uses the normal distribution approximation. |

Note that Agresti and Coull (2000) suggest that the Wilson interval is the preferred method and is, thus, the default `type`

.

A #x2 matrix that contains the lower and upper confidence interval bounds as columns and, if `verbose=TRUE`

`x`

, `n`

, and `x/n`

.

Derek H. Ogle, derek@derekogle.com, though this is largely based on `binom.exact`

, `binom.wilson`

, and `binom.approx`

from the old epitools package.

Agresti, A. and B.A. Coull. 1998. Approximate is better than “exact” for interval estimation of binomial proportions. American Statistician, 52:119-126.

See `binom.test`

; `binconf`

in Hmisc; and functions in binom.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## All types at once
binCI(7,20)
## Individual types
binCI(7,20,type="wilson")
binCI(7,20,type="exact")
binCI(7,20,type="asymptotic")
binCI(7,20,type="asymptotic",verbose=TRUE)
## Multiple types
binCI(7,20,type=c("exact","asymptotic"))
binCI(7,20,type=c("exact","asymptotic"),verbose=TRUE)
## Use with multiple inputs
binCI(c(7,10),c(20,30),type="wilson")
binCI(c(7,10),c(20,30),type="wilson",verbose=TRUE)
``` |

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.