ci_var: Confidence Interval for the Population Variance

View source: R/ci_var.R

ci_varR Documentation

Confidence Interval for the Population Variance

Description

This function calculates confidence intervals for the population variance. By default, classic confidence intervals are calculated based on the chi-squared distribution, assuming normal distribution (see Smithson). Bootstrap confidence intervals are also available and are recommended for the non-normal case as the chi-squared confidence intervals are sensitive to deviations from normality.

Usage

ci_var(
  x,
  probs = c(0.025, 0.975),
  type = c("chi-squared", "bootstrap"),
  boot_type = c("bca", "perc", "stud", "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 "chi-squared" (default) or "bootstrap".

boot_type

Type of bootstrap confidence interval ("bca", "perc", "stud", "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 is "bca" (bias-corrected accelerated) as it enjoys the property of being second order accurate as well as transformation respecting (see Efron, p. 188). The "stud" (bootstrap t) bootstrap uses a general formula for the standard error of the sample variance given in Wilks.

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. S.S. Wilks (1962), Mathematical Statistics, Wiley & Sons.

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

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

See Also

ci_sd.

Examples

x <- 1:100
ci_var(x)
ci_var(x, type = "bootstrap", R = 999)

confintr documentation built on Sept. 29, 2022, 5:13 p.m.