Learn R Programming

mosaic (version 0.9-0)

confint.numeric: Confidence interval methods for output of resampling

Description

Methods for confint to compute confidence intervals on numerical vectors and numerical components of data frames.

Usage

## S3 method for class 'numeric':
confint(object, parm, level = 0.95, ...,
  method = "stderr", margin.of.error = "stderr" \%in\% method == "stderr")

## S3 method for class 'do.data.frame': confint(object, parm, level = 0.95, ..., method = "stderr", margin.of.error = "stderr" \%in\% method)

## S3 method for class 'data.frame': confint(object, parm, level = 0.95, ...)

## S3 method for class 'summary.lm': confint(object, parm, level = 0.95, ...)

Arguments

method
either "stderr" (default) or "quantile". ("se" and "percentile" are allowed as aliases) or a vector containing both.
margin.of.error
if true, report intervals as a center and margin of error.
...
additional arguments
object
and R object
parm
a vector of parameters
level
a confidence level

Value

  • When applied to a data frame, returns a data frame giving the confidence interval for each variable in the data frame using t.test or binom.test, unless the data frame was produced using do, in which case it is assumed that each variable contains resampled statistics that serve as an estimated sampling distribution from which a confidence interval can be computed using either a central proportion of this distribution or using the standard error as estimated by the standard deviation of the estimated sampling distribution. When applied to a numerical vector, returns a vector.

Examples

Run this code
s <- do(500)*mean( age ~ sex, data=resample(HELPrct) )
confint(s)
confint(s, method="quantile")
confint(s, margin.of.error=TRUE)
confint(s, margin.of.error=TRUE, level=0.99 )
s2 <- do(500)*mean( resample(1:10) )
confint(s2)
confint( summary(lm(width ~ length * sex, data=KidsFeet)) )

Run the code above in your browser using DataLab