ci: Return confidence intervals of a variable

Description Usage Arguments Value Examples

Description

Return confidence intervals of a variable

Usage

1
2
3
4
5
6
7
## S3 method for class 'numeric'
ci(x, level = 0.95, na.rm = TRUE, df = Inf)

## Default S3 method:
ci(x, level = 0.95, na.rm = TRUE)

ci(x, ...)

Arguments

x

A vector

level

Confidence level

na.rm

Logical. Should missing values be removed?

df

Degrees of freedom. By default this is Inf which is equivalent to assuming a normal distribution.

Value

A length-two vector giving a confidence interval. If x is numeric, the confidence interval around the mean is calculated using the t distribution.

If x is logical, or a factor with two levels, the binomial confidence interval is calculated for the proportion of TRUE cases, or cases on the first level, using prop.test.

Examples

1
2
3
4
ci(rnorm(10), 0.95)
a <- rnorm(10)
ci(a, 0.99)
ci(a, 0.99, df = 10)

hughjonesd/ffplot documentation built on May 17, 2019, 9:11 p.m.