binom_summary: Summary statistics for binomial data

Description Usage Arguments Details Value Examples

Description

Function computes summary statistics for a binomial outcome variable. It computes the mean and the confidence intervals using the Agresti-Coull method.

Usage

1
binom_summary(outcome)

Arguments

outcome

A vector containing the outcome of a binomial response. The values have to be either logical (TRUE/FALSE) or zeros and ones, where TRUE and one mark a success.

Details

Agresti-Coull method: For a 95% confidence interval, this method does not use the concept of "adding 2 successes and 2 failures," but rather uses the formulas explicitly described in the following link: http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Agresti-Coull_Interval.

Value

a data.frame

Examples

1
2
3
4
5
6
7
library(dplyr)

df <- data.frame(group = rep(c("a", "b"), each = 20), outcome = c(rbinom(20,1, 0.7), rbinom(20,1,0.2)))

df %>%
group_by(group) %>%
do(binom_summary(.$outcome))

tgraf0/xlincHelpers documentation built on May 5, 2019, 1:36 a.m.