ci_proportion {confintr} | R Documentation |

## CI for a Population Proportion

### Description

This function calculates CIs for a population proportion. By default,
"Clopper-Pearson" CIs are calculated (via `stats::binom.test()`

).
Further possibilities are "Wilson" (without continuity correction),
"Agresti-Coull" (using normal quantile instead of +2 correction),
and "bootstrap" (by default "bca").

### Usage

```
ci_proportion(
x,
n = NULL,
probs = c(0.025, 0.975),
type = c("Clopper-Pearson", "Agresti-Coull", "Wilson", "bootstrap"),
boot_type = c("bca", "perc", "stud", "norm", "basic"),
R = 9999L,
seed = NULL,
...
)
```

### Arguments

`x` |
A numeric vector with one value (0/1) per observation, or the number of successes. |

`n` |
The sample size. Only needed if |

`probs` |
Lower and upper probabilities, by default |

`type` |
Type of CI. One of "Clopper-Pearson" (the default), "Agrestiâ€“Coull", "Wilson", "bootstrap". |

`boot_type` |
Type of bootstrap CI. Only used for |

`R` |
The number of bootstrap resamples. Only used for |

`seed` |
An integer random seed. Only used for |

`...` |
Further arguments passed to |

### Details

Note that we use the formulas for the Wilson and Agresti-Coull intervals in
https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval.
They agree with `binom::binom.confint(x, n, method = "ac"/"wilson")`

.

### Value

An object of class "cint", see `ci_mean()`

for details.

### References

Clopper, C. and Pearson, E. S. (1934). The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika. 26 (4).

Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22 (158).

Agresti, A. and Coull, B. A. (1998). Approximate is better than 'exact' for interval estimation of binomial proportions. The American Statistician, 52 (2).

### Examples

```
x <- rep(0:1, times = c(50, 100))
ci_proportion(x)
ci_proportion(x, type = "Wilson")
ci_proportion(x, type = "Agresti-Coull")
```

*confintr*version 1.0.2 Index]