Constructing confidence intervals
This online calculator constructs confidence intervals for four cases: for estimating the mean with unknown parameter values, for estimating variance with unknown parameter values, for estimating the mean with known variance, and for estimating variance with known mean.
Formulas and some theory can be found below the calculator.
Methods for constructing confidence intervals under the condition that the source data are normal
| No. | What we estimate | What is known | Statistic used | Distribution | Confidence interval |
|---|---|---|---|---|---|
| 1 | Variance |
Mean |
|||
| 2 | Mean |
Variance |
|||
| 3 | Mean |
Both unknown (estimating |
|||
| 4 | Variance |
Both unknown (estimating |
Below I will explain where each thing comes from.
Method for constructing confidence intervals
In the general case (this is not the only method, but I did not look for others), confidence intervals can be constructed as follows1:
- Choose a confidence probability
close to one.
- Choose some function depending on our sample and on the unknown parameter
, but such that, in turn, ITS distribution function does not depend on the unknown parameter
:
- Choose two numbers
and
such that
. Next we are interested in values
and
such that
Whence
Since we chose such that its distribution function does not depend on
, then
and
also do not depend on
.
- Move to the double inequality
and solve it for . The values will depend on the sample. If the solution is denoted by
, then we can write
The computed values will be the confidence interval. I.e. an interval into which the true value of the unknown quantity falls with a given probability.
Actually, everything further has already been calculated before us - for the above cases, functions with known distributions have already been selected that allow confidence intervals to be calculated. Along the way, new distributions had to be introduced and theorems proved, but this is rather difficult. Students and engineers need only know that it is so, and the conditions of application. Below we consider each case separately.
Constructing a confidence interval for the mean with known variance
Let us start with the simplest case to explain - constructing a confidence interval for the mean with known variance. How can the variance of a random variable be known, you ask. However, this is a fairly common case in practice, since variance, or spread, most often characterizes the physical properties of an instrument or technological process. A classic example: the error of an instrument, indicated in its passport as the standard deviation. We do not know the true value of the measured quantity, but we do know the "noise" of the instrument. We make a series of measurements and construct a confidence interval for the mean value using the standard deviation.
The clever function for this case was chosen as follows
Here the theorem is used that the sum of an arbitrary number of independent normal random variables has a normal distribution. In this case the function has the standard normal distribution
. We can write the double inequality using quantiles
Whence
Or, due to the symmetry of the normal distribution
Constructing a confidence interval for the mean with unknown variance
Now let us consider constructing a confidence interval for the mean value of some random variable when we know neither its true mean value nor its true variance. This is the most frequent case when you obtain a series of measurements of something - most often you know nothing at all.
For example, you want to check how a new fertilizer affects the tomato harvest.
You planted 30 beds, applied fertilizer, and measured the resulting yield in kilograms. The true mean is the potential yield of the variety with fertilizer applied, if it were planted everywhere under ideal average conditions. It is unknown. The true variance in this case is the responsiveness to microclimate and errors in watering / fertilizer application. One bed is located in a lowland (more moisture), another on a hill (drier), and so on. How strongly does yield change from bed to bed? That is also unknown.
Here the choice of the clever function is determined by Fisher's theorem. Here is its formulation from Wikipedia2:
Let be an independent sample from a normal distribution. Let
be the sample mean, and
the sample variance. Then
- The random variables
and
are independent;
- The random variable
has a standard normal distribution
- The random variable
has a chi-square distribution with
degrees of freedom.
And from the standard normal distribution and the chi-square distribution one can assemble the Student distribution by the following formula
, where
is the number of degrees of freedom.
So let us construct our function by dividing one by the root of the other divided by
:
We know that this function has the Student distribution with degrees of freedom, plus, luckily, the unknown parameter
can be canceled in it
Thus
And then, denoting the quantiles of the Student distribution by and expressing
, we obtain the confidence interval formula.
Since the Student distribution is symmetric, here it is also enough to substitute only one quantile value into the formula, as in the previous case.
Constructing a confidence interval for variance with known mean
We have dealt with estimating means, but it seems we also need to estimate variance. And the first case is constructing a confidence interval for variance with a known true mean. Again, where in real life are there tasks where the true mean is known and variance is needed? The first option is problems inverse to the problem of estimating the mean with known variance, namely, calibration of an instrument. That is, start placing a reference 1-kilogram weight on the scales and see what they show, estimate the spread of values shown by the scales (putting the weight not once, obviously). Besides, the mean can be fixed in hypothesis testing (they look at what the spread will be if the mean is like this).
We construct the function as follows:
Here everything is simple - this is literally the chi-square distribution with degrees of freedom, and it does not depend on
.
Denoting the quantiles of the chi-square distribution by and expressing
, we obtain the confidence interval formula.
The chi-square distribution is asymmetric, so both quantiles have to be taken.
Constructing a confidence interval for variance with unknown mean
Why is this needed? For the same reason as in the previous case. We want to estimate the variability, the "tightness" or "stability" of a process, only the true mean is unknown to us.
For this case the following function was constructed:
The "catch" here is that the unknown value does not participate in the function at all. And by Fisher's theorem we know that this function has a chi-square distribution with
degrees of freedom. Then we do the same as in the previous case and obtain the confidence interval formula:
Applicability criteria
Let us repeat once more - all formulas listed above in the table (using quantiles of the normal distribution, Student distribution, and chi-square distribution) are exact only in one single case: the original random variable must be distributed strictly according to the normal law (Gauss).
If the distribution is not normal, then when estimating the mean with a large sample size we are lucky - thanks to the Central Limit Theorem (CLT), as the sample size grows the sample mean always tends to a normal distribution, regardless of what distribution the original data had (exponential, uniform, binomial, etc.). The traditional boundary between a small and a large sample in statistics is 30. Sometimes people speak of a sample of size 50 - 100, but much here depends on the asymmetry of the distribution or the heaviness of its "tails".
Conclusion - when estimating the mean for large samples, the distribution can be ignored (thanks to the CLT). For small samples from a NON-normal distribution (for example, binomial or lognormal), Student criteria give an error — nonparametric methods must be used (for example, the Wilcoxon test).
For variance, everything is bad. The chi-square distribution is extremely sensitive to deviations from normality, and for non-normal distributions other approaches must be used.
-
Manita A. D. Probability Theory and Mathematical Statistics: Textbook. -- Moscow: Publishing Department of UNTs DO, 2001. -- 120 p. TeorVer-Online ↩
Similar calculators
- • Log-normal distribution
- • Normal distribution
- • Binomial distribution, probability density function, cumulative distribution function, mean and variance
- • Poisson Distribution. Probability density function, cumulative distribution function, mean and variance
- • Normally distributed random numbers generator
- • Statistics section ( 38 calculators )
Comments