ci_mean {confintr} R Documentation

Confidence Interval for the Population Mean

Description

This function calculates confidence intervals for the population mean. By default, Student's t method is used. Alternatively, Wald and bootstrap confidence intervals are available.

Usage

ci_mean(
x,
probs = c(0.025, 0.975),
type = c("t", "Wald", "bootstrap"),
boot_type = c("stud", "bca", "perc", "norm", "basic"),
R = 9999,
seed = NULL,
...
)


Arguments

 x A numeric vector. probs Error probabilites. The default c(0.025, 0.975) gives a symmetric 95% confidence interval. type Type of confidence interval. One of "t" (default), "Wald", or "bootstrap". boot_type Type of bootstrap confidence interval ("stud", "bca", "perc", "norm", "basic"). Only used for type = "bootstrap". R The number of bootstrap resamples. Only used for type = "bootstrap". seed An integer random seed. Only used for type = "bootstrap". ... Further arguments passed to boot::boot.

Details

Bootstrap confidence intervals are calculated by the package "boot", see references. The default bootstrap type for the mean is "stud" (bootstrap t) as it enjoys the property of being second order accurate and has a stable variance estimator (see Efron, p. 188).

Value

A list with class cint containing these components:

• parameter: The parameter in question.

• interval: The confidence interval for the parameter.

• estimate: The estimate for the parameter.

• probs: A vector of error probabilities.

• type: The type of the interval.

• info: An additional description text for the interval.

References

1. Smithson, M. (2003). Confidence intervals. Series: Quantitative Applications in the Social Sciences. New York, NY: Sage Publications.

2. Efron, B. and Tibshirani R. J. (1994). An Introduction to the Bootstrap. Chapman & Hall/CRC.

3. Canty, A and Ripley B. (2019). boot: Bootstrap R (S-Plus) Functions.

Examples

x <- 1:100
ci_mean(x)
ci_mean(x, type = "bootstrap", R = 999, seed = 1)
ci_mean(x, type = "bootstrap", R = 999, probs = c(0.025, 1), seed = 1)
ci_mean(x, type = "bootstrap", R = 999, probs = c(0, 0.975), seed = 1)


[Package confintr version 0.1.2 Index]