### Where do the confidence interval and margin of error come from?

**They say**: A **confidence interval** is an interval containing the most believable values for a parameter.

The probability that this method produces an interval that contains the parameter is called the **confidence level**. This is a number chosen to be close to 1, most commonly 0.95... The key is the *sampling distribution* of the point estimate. This distribution tells us the probability that the point estimate will fall within any certain distance of the parameter (Agresti and Franklin, p.352)... The **margin of error** measures how accurate the point estimate is likely to be in estimating a parameter. It is a multiple of the standard deviation of the sampling distribution of the estimate, such as 1.96 x (standard deviation) when the sampling distribution is a normal distribution (p.353)

**I say**: Confidence intervals, invented by **Jerzy Neyman**, were an important contribution to the statistical science. The logic behind them is substantial. Some math is better to hide from students but not in this case. The authors keep in mind complex notions involving math and try to deliver them verbally. Instead of hoping that students will recreate mentally those notions, why not give them directly?

### Motivation

I ask my students what kind of information they would prefer:

a) I predict the price of Apple stock to be $114 tomorrow or

b) Tomorrow the price of Apple stock is expected to stay within $1 distance from $114 with probability 95%, that is .

Everybody says statement b) is better. A follow-up question: Do you want the probability in statement b) to be high or low? Unanimous answer: High. A series of definitions follows.

An interval containing the values of a random variable with high probability

(1)

is called a **confidence interval**. The value which controls probability is called a **confidence level** and the number is called a **level of significance**. The interpretation of is that as follows from (1).

### How to find a confidence interval

We want the confidence level to be close to 1 and the significance level to be close to zero. In applications, we choose them and we need to find the interval from equation (1).

**Step 1**. Consider the standard normal. (1) becomes . Note that usually it is impossible to find two unknowns from one equation. Therefore we look for a symmetric interval, in which case we have to solve

(2)

for . The solution is called a **critical value** corresponding to the confidence level or significance level . It is impossible to find it by hand, that's why people use statistical tables. In Mathematica, the critical value is given by

=Max[NormalCI[0, 1, ConfidenceLevel -> p]].

Geometrically, it is obvious that, as the confidence level approaches 1, the critical value goes to infinity, see the video or download the Mathematica file.

**Step 2**. In case of a general normal variable, plug its z-score in (2):

(3)

The event is the same as which is the same as . Hence, their probabilities are the same:

(4)

We have found the confidence interval for a normal variable. This explains where the **margin of error** comes from.

**Step 3**. In case of a random variable which is not necessarily normal we can use the central limit theorem. z-scores of sample means , for example, approach the standard normal. Instead of (3) we have an approximation

Then instead of (4) we get

In my classes, I insist that logically interconnected facts should be given in one place. To consolidate this information, I give my students the case of one-sided intervals as an exercise.