Learn R Programming

mosaic (version 0.8-3)

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, ...)

Arguments

object
The data frame or numerical vector.
parm
not used -- for compatibility with other confint methods
level
confidence level (default 0.95)
...
additional arguments (currently ignored)
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.

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)

Run the code above in your browser using DataLab