binom.conf.interval {UCS} R Documentation

## Binomial Confidence Intervals

### Description

Computes confidence intervals for the success probability of a binomial distribution efficiently. Unlike `binom.test`, this function can be applied to vectors.

### Usage

```binom.conf.interval(k, size, limit=c("lower","upper"),
conf.level=0.05, one.sided=FALSE)
```

### Arguments

 `k` a vector of non-negative integers. Each element represents the number of successes out of `size` trials, i.e. the observed value of a random variable with binomial distribution. `size` a vector of positive integers. Each element represents the number of trials of a binomial distribution. `limit` if `"upper"`, the upper boundaries of the confidence intervals are returned. If `"lower"`, the lower boundaries are returned. Note that this works both for one-sided and for two-sided confidence intervals. `conf.level` the required confidence level, or rather the significance level of the corresponding binomial test (note that this behaviour differs from the built-in `binom.test` function). The default `conf.level=0.05` stands for 95% confidence. `one.sided` if `TRUE`, computes one-sided confidence interval (either lower or upper, depending on the value of `limit`). If `FALSE`, a two-sided confidence interval is computed (default).

### Details

If `one.sided=TRUE`, the underlying test is one-sided (with alternative `"less"` or `"greater"`, depending on the `limit` parameter), and the non-trivial boundary of the confidence interval is returned.

If `one.sided=FALSE`, the underlying test is two-sided and the requested boundary of the two-sided confidence interval is returned. For efficiency reasons, the `binom.conf.interval` function cheats a little and computes one-sided confidence intervals with significance level `conf.level / 2`.

### Value

A numeric vector with the requested boundary of confidence intervals for the unknown success probabilities of binomial variables.

`binom.test`