Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ci

Compute Confidence Intervals


Description

Compute and display confidence intervals for model estimates. Methods are provided for the mean of a numeric vector ci.default, the probability of a binomial vector ci.binom, and for lm, lme, and mer objects are provided.

Usage

ci(x, confidence=0.95, alpha=1 - confidence, ...)
  ## S3 method for class 'numeric'
ci(x, confidence=0.95, alpha=1-confidence, na.rm=FALSE, ...)
  ## S3 method for class 'binom'
ci(x, confidence=0.95, alpha=1-confidence, ...)
  ## S3 method for class 'lm'
ci(x, confidence=0.95, alpha=1-confidence, ...)
  ## S3 method for class 'lme'
ci(x, confidence=0.95, alpha=1-confidence, ...)

  ## S3 method for class 'estimable'
ci(x, confidence=0.95, alpha=1-confidence, ...)
  ## S3 method for class 'fit_contrast'
ci(x, confidence=0.95, alpha=1-confidence, ...)

Arguments

x

object from which to compute confidence intervals.

confidence

confidence level. Defaults to 0.95.

alpha

type one error rate. Defaults to 1.0-confidence

na.rm

boolean indicating whether missing values should be removed. Defaults to FALSE.

...

Arguments for methods

Value

vector or matrix with one row per model parameter and elements/columns Estimate, CI lower, CI upper, Std. Error, DF (for lme objects only), and p-value.

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

Examples

# mean and confidence interval
ci( rnorm(10) )

# binomial proportion and exact confidence interval
b <- rbinom( prob=0.75, size=1, n=20 )
ci.binom(b) # direct call
class(b) <- 'binom'
ci(b)       # indirect call

# confidence intervals for regression parameteres
data(state)
reg  <-  lm(Area ~ Population, data=as.data.frame(state.x77))
ci(reg)

gmodels

Various R Programming Tools for Model Fitting

v2.18.1
GPL-2
Authors
Gregory R. Warnes, Ben Bolker, Thomas Lumley, and Randall C Johnson. Contributions from Randall C. Johnson are Copyright (2005) SAIC-Frederick, Inc. Funded by the Intramural Research Program, of the NIH, National Cancer Institute, Center for Cancer Research under NCI Contract NO1-CO-12400.
Initial release
2018-06-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.