Skip to content

S3 Chapter 3: Estimation and Confidence Intervals

From Data to Decisions: Understanding What Sample Tells Us

Section titled “From Data to Decisions: Understanding What Sample Tells Us”

In Chapter 1, we learned how to collect a representative sample from a population. We carefully selected 200 students from HelloTea’s 3,000-student customer base using proper sampling methods. Now we face the next crucial question:

What do we do with this data?

After conducting our survey, we calculated the sample mean satisfaction score: Xˉ=4.2\bar{X} = 4.2 (on a scale of 0 to 5). This is our best guess for the true mean satisfaction μ\mu of all 3,000 students. But how reliable is this estimate?

To answer these questions rigorously, we need a mathematical framework. This chapter develops the theory of statistical estimation and shows how to quantify uncertainty using confidence intervals.

Before we proceed, we must be explicit about the assumptions underlying our methods.

We used the sample mean Xˉ=4.2\bar{X} = 4.2 to estimate the population mean μ\mu. This seems natural - after all, the average of our sample should tell us something about the average of the population. But how do we know this is a good estimate?

To answer this, we need to formalize what we mean by an “estimator.”

Definition: Estimator

An estimator is a statistic (a function of sample data) used to estimate an unknown population parameter.

A point estimator produces a single numerical value as an estimate.

Notation: We typically use θ^\hat{\theta} to denote an estimator of the parameter θ\theta.

Example: HelloTea Estimators

In our satisfaction survey:

  • Population parameter: μ\mu = true mean satisfaction of all 3,000 students (unknown)
  • Estimator: Xˉ\bar{X} = sample mean = 1ni=1nXi\frac{1}{n}\sum_{i=1}^{n} X_i
  • Estimate: xˉ=4.2\bar{x} = 4.2 (the specific value we observed)

Note: Xˉ\bar{X} is a random variable (an estimator), while xˉ=4.2\bar{x} = 4.2 is the specific number we calculated.

Now that we have an estimator Xˉ\bar{X} for μ\mu, we face two critical questions:

The first question is whether our estimator is systematically biased - does it tend to be too high or too low?

Definition: Bias

The bias of an estimator θ^\hat{\theta} for a parameter θ\theta is defined as: Bias(θ^)=E[θ^]θ\text{Bias}(\hat{\theta}) = E[\hat{\theta}] - \theta

An estimator is unbiased if E[θ^]=θE[\hat{\theta}] = \theta, i.e., if Bias(θ^)=0\text{Bias}(\hat{\theta}) = 0.

Interpretation: An unbiased estimator is “correct on average” - if we repeated the sampling process infinitely many times, the average of all our estimates would equal the true parameter.

Let’s check whether Xˉ\bar{X} is an unbiased estimator of μ\mu.

Question: Is E[Xˉ]=μE[\bar{X}] = \mu?

To answer this, we need to calculate E[Xˉ]E[\bar{X}]. The linearity rules were covered in the Combinations of Random Variables handout, so here we focus on how they are used in estimation.

Now we can check if Xˉ\bar{X} is unbiased:

Example: Sample Mean is Unbiased

Calculate:

E[Xˉ]=E[1200i=1200Xi]=1200E[i=1200Xi]=1200i=1200E[Xi]=1200i=1200μ=μ\begin{aligned} E[\bar{X}] &= E\left[\frac{1}{200}\sum_{i=1}^{200} X_i\right] = \frac{1}{200} E\left[\sum_{i=1}^{200} X_i\right] = \frac{1}{200} \sum_{i=1}^{200} E[X_i] = \frac{1}{200} \sum_{i=1}^{200} \mu = \mu \end{aligned}

Conclusion: E[Xˉ]=μE[\bar{X}] = \mu, so the sample mean is an unbiased estimator of the population mean!

Interpretation: On average (over many repeated samples), Xˉ\bar{X} equals the true mean μ\mu. Our specific observation xˉ=4.2\bar{x} = 4.2 might be above or below μ\mu, but the method is not systematically biased.

Example: Sample Variance and the Discovery of Bias

Section titled “Example: Sample Variance and the Discovery of Bias”

Not all natural estimators are unbiased. Let’s examine the sample variance.

Example: The Biased Sample Variance

Suppose we want to estimate the population variance σ2\sigma^2. The natural estimator might seem to be: Natural estimator: 1ni=1n(XiXˉ)2\text{Natural estimator: } \frac{1}{n}\sum_{i=1}^{n}(X_i - \bar{X})^2

This is just the average squared deviation from the sample mean. Is it unbiased?

Let’s calculate (for simplicity, we’ll show the key idea):

It can be proven that (please refer to the challenge exercise for details): E[1ni=1n(XiXˉ)2]=n1nσ2E\left[\frac{1}{n}\sum_{i=1}^{n}(X_i - \bar{X})^2\right] = \frac{n-1}{n}\sigma^2

Discovery: This is NOT equal to σ2\sigma^2! The bias is: Bias=n1nσ2σ2=1nσ2<0\text{Bias} = \frac{n-1}{n}\sigma^2 - \sigma^2 = -\frac{1}{n}\sigma^2 < 0

The natural estimator systematically underestimates the true variance.

Why?

When we use Xˉ\bar{X} (which is calculated from the same data), we’re making the deviations artificially small. The sample mean Xˉ\bar{X} minimizes (XiXˉ)2\sum(X_i - \bar{X})^2, so using it makes the variance appear smaller than it truly is.

To fix this bias, we use the corrected formula:

Definition: Unbiased Sample Variance

The sample variance (unbiased estimator of σ2\sigma^2) is: S2=1n1i=1n(XiXˉ)2S^2 = \frac{1}{n-1}\sum_{i=1}^{n}(X_i - \bar{X})^2

This correction factor (n1)(n-1) is called the degrees of freedom.

Verification: E[S2]=E[1n1i=1n(XiXˉ)2]=nn1n1nσ2=σ2E[S^2] = E\left[\frac{1}{n-1}\sum_{i=1}^{n}(X_i - \bar{X})^2\right] = \frac{n}{n-1} \cdot \frac{n-1}{n}\sigma^2 = \sigma^2 \checkmark

Example: HelloTea: Using the Correct Formula

In our satisfaction survey with n=200n = 200 students:

  • If we calculated i=1200(Xi4.2)2=288\sum_{i=1}^{200}(X_i - 4.2)^2 = 288
  • Wrong (biased): Variance 288200=1.44\approx \frac{288}{200} = 1.44
  • Correct (unbiased): S2=2881991.447S^2 = \frac{288}{199} \approx 1.447

The difference is small here, but the principle matters: always use n1n-1 for sample variance!

We’ve established that Xˉ\bar{X} is unbiased (E[Xˉ]=μE[\bar{X}] = \mu), which is good news! But being unbiased doesn’t tell the whole story. Consider this thought experiment:

This variability is captured by the standard error.

Definition: Standard Error

The standard error of an estimator θ^\hat{\theta} is the standard deviation of its sampling distribution: SE(θ^)=Var(θ^)\text{SE}(\hat{\theta}) = \sqrt{\text{Var}(\hat{\theta})}

Interpretation: A smaller standard error means a more precise (less variable) estimator.

For the sample mean under independent sampling:

Var(Xˉ)=σ2nSE(Xˉ)=σn.\text{Var}(\bar{X})=\frac{\sigma^2}{n} \quad\Rightarrow\quad \boxed{\text{SE}(\bar{X})=\frac{\sigma}{\sqrt{n}}}.

The formula SE(Xˉ)=σn\text{SE}(\bar{X}) = \frac{\sigma}{\sqrt{n}} reveals important insights:

Let’s apply this to our satisfaction survey:

Example: HelloTea Standard Error

Scenario: From historical data or a pilot study, suppose we know that satisfaction ratings have standard deviation σ=1.2\sigma = 1.2 points (on the 0-5 scale).

Our sample: n=200n = 200 students, Xˉ=4.2\bar{X} = 4.2

Calculate SE: SE(Xˉ)=σn=1.2200=1.214.1420.0849\text{SE}(\bar{X}) = \frac{\sigma}{\sqrt{n}} = \frac{1.2}{\sqrt{200}} = \frac{1.2}{14.142} \approx 0.0849

Interpretation: The sample mean Xˉ\bar{X} typically varies by about ±0.085\pm 0.085 points from the true mean μ\mu.

If we repeated the survey many times with different random samples of 200 students, about 68% of the sample means would fall within μ±0.085\mu \pm 0.085.

In practice, we usually don’t know the population standard deviation σ\sigma. What do we do?

Note: For large samples (n30n \geq 30), the difference between using σ\sigma and SS is negligible.

4. Confidence Intervals: Quantifying Uncertainty

Section titled “4. Confidence Intervals: Quantifying Uncertainty”

So far, we’ve learned:

  • Xˉ=4.2\bar{X} = 4.2 is an unbiased estimate of μ\mu (no systematic error)
  • SE(Xˉ)0.085\text{SE}(\bar{X}) \approx 0.085 tells us the typical variability

But when we report to HelloTea’s manager, saying “the mean satisfaction is 4.2 with SE of 0.085” isn’t very intuitive. A better approach is to give a range of plausible values for μ\mu.

To construct meaningful intervals, we need to understand the distribution of Xˉ\bar{X} - not just its mean and variance, but its entire probability distribution. This is where our normality assumption becomes crucial!

For confidence intervals, we use the key result:

XˉN(μ,σ2n)\bar{X} \sim N\left(\mu, \frac{\sigma^2}{n}\right)

under independent normal sampling.

Now we can build our confidence interval by standardizing Xˉ\bar{X}:

Example: Deriving the 95% Confidence Interval

Start with what we know: Z=Xˉμσ/nN(0,1)Z = \frac{\bar{X} - \mu}{\sigma/\sqrt{n}} \sim N(0,1)

Use the 95% probability: P(1.96<Z<1.96)=0.95P(-1.96 < Z < 1.96) = 0.95

Substitute the formula for ZZ: P(1.96<Xˉμσ/n<1.96)=0.95P\left(-1.96 < \frac{\bar{X} - \mu}{\sigma/\sqrt{n}} < 1.96\right) = 0.95

Multiply all parts by σ/n\sigma/\sqrt{n}: P(1.96σn<Xˉμ<1.96σn)=0.95P\left(-1.96 \cdot \frac{\sigma}{\sqrt{n}} < \bar{X} - \mu < 1.96 \cdot \frac{\sigma}{\sqrt{n}}\right) = 0.95

Rearrange to isolate μ\mu in the middle: P(Xˉ1.96σn<μ<Xˉ+1.96σn)=0.95P\left(\bar{X} - 1.96 \cdot \frac{\sigma}{\sqrt{n}} < \mu < \bar{X} + 1.96 \cdot \frac{\sigma}{\sqrt{n}}\right) = 0.95

This can be written compactly as: P(Xˉ1.96SE(Xˉ)<μ<Xˉ+1.96SE(Xˉ))=0.95P\left(\bar{X} - 1.96 \cdot \text{SE}(\bar{X}) < \mu < \bar{X} + 1.96 \cdot \text{SE}(\bar{X})\right) = 0.95

Or more simply: μ[Xˉ±1.96SE(Xˉ)]\mu \in \left[\bar{X} \pm 1.96 \cdot \text{SE}(\bar{X})\right] with probability 0.95

Definition: Confidence Interval for the Mean

A 100(1α)%100(1-\alpha)\% confidence interval for the population mean μ\mu is:

Xˉ±z×SE(Xˉ)=Xˉ±z×σn\boxed{\bar{X} \pm z^* \times \text{SE}(\bar{X}) = \bar{X} \pm z^* \times \frac{\sigma}{\sqrt{n}}}

where zz^* is chosen so that P(z<Z<z)=1αP(-z^* < Z < z^*) = 1 - \alpha for ZN(0,1)Z \sim N(0,1).

Common confidence levels:

Confidence Levelα\alphazz^* value
90%0.101.645
95%0.051.96
99%0.012.576

When σ\sigma is unknown: Replace σ\sigma with sample standard deviation SS: Xˉ±z×Sn\bar{X} \pm z^* \times \frac{S}{\sqrt{n}}

HelloTea: Computing the Confidence Interval

Section titled “HelloTea: Computing the Confidence Interval”

Let’s put everything together for our satisfaction survey:

Example: HelloTea 95% Confidence Interval

Given data:

  • Sample size: n=200n = 200 students
  • Sample mean: Xˉ=4.2\bar{X} = 4.2 points
  • Sample standard deviation: S=1.2S = 1.2 points
  • Confidence level: 95% (so z=1.96z^* = 1.96)

Step 1: Calculate the standard error SE(Xˉ)=Sn=1.2200=1.214.142=0.08490.085\text{SE}(\bar{X}) = \frac{S}{\sqrt{n}} = \frac{1.2}{\sqrt{200}} = \frac{1.2}{14.142} = 0.0849 \approx 0.085

Step 2: Calculate the margin of error Margin of Error=z×SE(Xˉ)=1.96×0.085=0.16660.167\text{Margin of Error} = z^* \times \text{SE}(\bar{X}) = 1.96 \times 0.085 = 0.1666 \approx 0.167

Step 3: Construct the interval

95% CI=Xˉ±Margin of Error=4.2±0.167=[4.033,4.367]\begin{aligned} \text{95\% CI} &= \bar{X} \pm \text{Margin of Error}\\ &= 4.2 \pm 0.167\\ &= [4.033, 4.367] \end{aligned}

Report: “We are 95% confident that the true mean satisfaction score for all 3,000 students lies between 4.03 and 4.37 points.”

Factors Affecting Confidence Interval Width

Section titled “Factors Affecting Confidence Interval Width”

The width of a confidence interval tells us about the precision of our estimate. A narrower interval means we’ve pinned down μ\mu more precisely.

Example: HelloTea: Comparing Different Confidence Levels

With Xˉ=4.2\bar{X} = 4.2, S=1.2S = 1.2, n=200n = 200, so SE=0.085\text{SE} = 0.085:

Confidence LevelCalculationInterval
90%4.2±1.645(0.085)4.2 \pm 1.645(0.085)[4.06, 4.34]
95%4.2±1.96(0.085)4.2 \pm 1.96(0.085)[4.03, 4.37]
99%4.2±2.576(0.085)4.2 \pm 2.576(0.085)[3.98, 4.42]

Observation: More confidence means casting a wider net. We’re more confident the interval contains μ\mu, but the interval tells us less precisely where μ\mu is.

This chapter developed the mathematical framework for statistical estimation:

ConceptFormulaHelloTea Value
Sample MeanXˉ=1ni=1nXi\bar{X} = \frac{1}{n}\sum_{i=1}^{n}X_i4.2
Expectation of Xˉ\bar{X}E[Xˉ]=μE[\bar{X}] = \muμ\mu (unbiased)
Variance of Xˉ\bar{X}Var(Xˉ)=σ2n\text{Var}(\bar{X}) = \frac{\sigma^2}{n}1.44200\frac{1.44}{200}
Standard ErrorSE(Xˉ)=σn\text{SE}(\bar{X}) = \frac{\sigma}{\sqrt{n}}0.085
95% CIXˉ±1.96×SE(Xˉ)\bar{X} \pm 1.96 \times \text{SE}(\bar{X})[4.03, 4.37]
Sample VarianceS2=1n1i=1n(XiXˉ)2S^2 = \frac{1}{n-1}\sum_{i=1}^{n}(X_i-\bar{X})^21.44

Throughout this chapter, we relied on several key assumptions. Let’s critically evaluate them:

The Big Question: What If Normality Fails?

Section titled “The Big Question: What If Normality Fails?”

Preview: The Central Limit Theorem to the Rescue

Section titled “Preview: The Central Limit Theorem to the Rescue”

The answer to our concerns comes from one of the most powerful results in all of statistics: