confIntProp: Confidence intervals for proportions, vectorized over all...

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

View source: R/confIntProp.R

Description

This function simply computes confidence intervals for proportions.

Usage

1
confIntProp(x, n, conf.level = 0.95)

Arguments

x

The number of 'successes', i.e. the number of events, observations, or cases that one is interested in.

n

The total number of cases or observatons.

conf.level

The confidence level.

Details

This function is the adapted source code of binom.test. Ir uses pbeta, with some lines of code taken from the binom.test source. Specifically, the count for the low category is specified as first 'shape argument' to pbeta, and the total count (either the sum of the count for the low category and the count for the high category, or the total number of cases if compareHiToLo is FALSE) minus the count for the low category as the second 'shape argument'.

Value

The confidence interval bounds in a twodimensional matrix, with the first column containing the lower bound and the second column containing the upper bound.

Author(s)

Unknown (see binom.test; adapted by Gjalt-Jorn Peters)

Maintainer: Gjalt-Jorn Peters <gjalt-jorn@userfriendlyscience.com>

See Also

binom.test and ggProportionPlot, the function for which this was written.

Examples

1
2
3
4
5
  ### Simple case
  confIntProp(84, 200);
  
  ### Using vectors
  confIntProp(c(2,3), c(10, 20), conf.level=c(.90, .95, .99));

userfriendlyscience documentation built on May 2, 2019, 1:09 p.m.