# confIntVariance-package: Confidence Interval for the Univariate Population Variance... In ConfIntVariance: Confidence Interval for the Univariate Population Variance without Normality Assumption

## Description

Surrounds the usual sample variance of a univariate numeric sample with a confidence interval for the population variance. This has been done so far only under the assumption that the underlying distribution is normal. Under the hood, this package implements the unique least-variance unbiased estimator of the variance of the sample variance, in a formula that is equivalent to estimating kurtosis and square of the population variance in an unbiased way and combining them according to the classical formula into an estimator of the variance of the sample variance. Both the sample variance and the estimator of its variance are U-statistics. By the theory of U-statistic, the resulting estimator is unique. See Fuchs, Krautenbacher (2016) <doi:10.1080/15598608.2016.1158675> and the references therein for an overview of unbiased estimation of variances of U-statistics.

## Details

The DESCRIPTION file: This package was not yet installed at build time.

Index: This package was not yet installed at build time.
A package providing one function varwci which is short for "variance with confidence interval."

## Author(s)

Mathias Fuchs Maintainer: Mathias Fuchs<mathias@mathiasfuchs.de>

## References

www.mathiasfuchs.de/b3.html

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54``` ```## ## Example: throwing a dice ## # True quantities that do not depend on n trueMeanOfDice <- mean(1:6) # The true variance of the dice # This is the quantity that we # want to estimate by embracing # with a confidence interval # instead of just estimating # with a point estimator as is # done in the function var trueVarianceOfDice <- mean((1:6)^2) - trueMeanOfDice^2 trueFourthCentralMomentOfDice <- mean(((1:6)-trueMeanOfDice)^4) # this requires some scribbling with paper and pencil # (or a study of Hoeffding 1948) trueVarianceOfSampleVarianceOfDice <- function(n) (trueFourthCentralMomentOfDice - trueVarianceOfDice^2 * (n-3)/(n-1))/n ## ## Simulation study: compute the coverage probability of ## the confidence interval by computing the probability ## that it contains the true value. ## We want that probability to be equal to the confidence level 0.95, ## not more and not less. (If it was higher, the test would be too conservative). ## # number of times we draw a # sample and compute a confidence interval N <- 1e4 trueValueCovered <- sapply( 1:N, function(i) { # throw a dice 100 times x <- sample(6, 100, replace=TRUE) # compute our confidence interval ci <- varwci(x) # We know that the true variance # of the dice is # 35/12 = 2.916666... # Record the boolean whether the # confidence interval contains # the true value. (35/12 > ci[1] && 35/12 < ci[2]) } ) # Result of simulation study: # Will be close to 0.95. print(mean(trueValueCovered)) ```

ConfIntVariance documentation built on May 2, 2019, 8:19 a.m.