Introduction to Sampling and Estimation

Welcome to Sampling and Estimation! In real life, it is almost always impossible, too expensive, or too time-consuming to measure every single item in a huge group (like testing every smartphone made in a factory or asking every person in Northern Ireland their opinion). Instead, we take a sample and use statistical techniques to make reliable conclusions about the entire population.

Don't worry if statistical theory seems abstract at first. In this chapter, we will break down the formulas step by step, explore the intuition behind why they work, and look at how to calculate unbiased estimates and confidence intervals with ease.


1. Populations, Samples, and Estimators

Key Definitions

Let's make sure we are clear on the fundamental vocabulary:

Population: The entire collection of all individuals, items, or measurements of interest (e.g. all lightbulbs produced by a machine).
Census: An investigation where information is gathered from every member of the population.
Sample: A subset of the population selected to represent the whole group.
Parameter: A numerical value describing a population, such as the true population mean \( \mu \) or true population variance \( \sigma^2 \). Parameters are fixed constants, but they are usually unknown.
Statistic: A numerical value calculated solely from the observations in a sample (such as the sample mean \( \bar{x} \)). It contains no unknown parameters.
Estimator: A statistic (a random variable) used to estimate an unknown population parameter. When calculated for a specific data set, the numerical result is called an estimate.

What Makes an Estimator "Unbiased"?

An estimator \( T \) for a population parameter \( \theta \) is said to be unbiased if its expected value is equal to the true parameter:

\( \text{E}(T) = \theta \)

Analogy: Imagine shooting arrows at a target. If your arrows are scattered around the bullseye and their average position is right on the centre, your aim is unbiased!


2. Estimating the Population Mean and Variance

Estimating the Population Mean \( \mu \)

Let \( X_1, X_2, \dots, X_n \) be a random sample of size \( n \) taken from a population with mean \( \mu \) and variance \( \sigma^2 \).
The sample mean is defined as:

\( \bar{X} = \frac{1}{n} \sum_{i=1}^{n} X_i \)

Taking expected values:

\( \text{E}(\bar{X}) = \text{E}\left(\frac{1}{n} \sum_{i=1}^{n} X_i\right) = \frac{1}{n} \sum_{i=1}^{n} \text{E}(X_i) = \frac{1}{n}(n\mu) = \mu \)

Therefore, the sample mean \( \bar{X} \) is an unbiased estimator of the population mean \( \mu \).

Estimating the Population Variance \( \sigma^2 \)

If we calculate the variance of the sample directly using \( \frac{1}{n} \sum (X_i - \bar{X})^2 \), it turns out to underestimate the true population variance. This is because sample values are naturally closer to their own sample mean \( \bar{X} \) than to the true population mean \( \mu \).

To fix this bias, we divide by \( n - 1 \) instead of \( n \). We denote the unbiased estimator of population variance as \( S^2 \):

\( S^2 = \frac{1}{n-1} \sum_{i=1}^{n} (X_i - \bar{X})^2 \)

For calculations from raw summary data, use the equivalent computational formula:

\( s^2 = \frac{1}{n-1} \left( \sum x^2 - \frac{(\sum x)^2}{n} \right) \)

The square root of this value, \( s = \sqrt{s^2} \), is the estimate of the population standard deviation \( \sigma \).

Quick Review:
• Unbiased estimate of mean \( \mu \): \( \bar{x} = \frac{\sum x}{n} \)
• Unbiased estimate of variance \( \sigma^2 \): \( s^2 = \frac{1}{n-1}\left( \sum x^2 - \frac{(\sum x)^2}{n} \right) \)


3. Sampling Distribution of the Sample Mean and the Central Limit Theorem (CLT)

Properties of the Distribution of \( \bar{X} \)

For any random sample of size \( n \) drawn from a population with mean \( \mu \) and variance \( \sigma^2 \):
• Mean of the sample mean: \( \text{E}(\bar{X}) = \mu \)
• Variance of the sample mean: \( \text{Var}(\bar{X}) = \frac{\sigma^2}{n} \)
• Standard error of the mean: \( \text{SE}(\bar{X}) = \frac{\sigma}{\sqrt{n}} \)

Notice: As the sample size \( n \) increases, the standard error decreases. Larger samples give more precise estimates!

The Central Limit Theorem (CLT)

The Central Limit Theorem is one of the most powerful results in statistics:

If a random sample of size \( n \) is taken from any population with mean \( \mu \) and finite variance \( \sigma^2 \), then as \( n \) becomes large (typically \( n \ge 30 \)), the sampling distribution of the sample mean \( \bar{X} \) is approximately normal:

\( \bar{X} \approx N\left(\mu, \frac{\sigma^2}{n}\right) \)

Important Distinction to Remember:
• If the parent population is already normally distributed, \( \bar{X} \sim N\left(\mu, \frac{\sigma^2}{n}\right) \) exactly for any sample size \( n \) (no CLT needed).
• If the parent population is not normal (or unknown), \( \bar{X} \) is only approximately normal, and this requires a large sample (\( n \ge 30 \)) by applying the CLT.


4. Confidence Intervals for the Population Mean \( \mu \)

A point estimate (like \( \bar{x} = 52.4 \)) gives a single guess for \( \mu \), but it doesn't tell us how confident we are. A confidence interval gives a range of values that is likely to contain the true parameter \( \mu \).

Case A: Normal Distribution or Large Sample (Known \( \sigma^2 \) or Large \( n \))

When the population variance \( \sigma^2 \) is known, or when the sample is large (\( n \ge 30 \)) so that \( \sigma^2 \) can be replaced by the unbiased estimate \( s^2 \), we use the standard normal distribution \( Z \sim N(0,1) \).

A \( (100 - \alpha)\% \) confidence interval for \( \mu \) is given by:

\( \bar{x} \pm z \times \frac{\sigma}{\sqrt{n}} \)

Where \( z \) is the critical value from the standard normal distribution corresponding to the desired confidence level:

• For a 90% confidence interval: \( z = 1.645 \)
• For a 95% confidence interval: \( z = 1.960 \)
• For a 99% confidence interval: \( z = 2.576 \)

Note: If \( \sigma \) is unknown but \( n \ge 30 \), we use:

\( \bar{x} \pm z \times \frac{s}{\sqrt{n}} \)

Case B: Small Sample from a Normal Population with Unknown \( \sigma^2 \) (Student's \( t \)-Distribution)

If the sample size is small (\( n < 30 \)), the population is assumed to be normally distributed, and the population variance \( \sigma^2 \) is unknown, we cannot use the standard normal distribution. Instead, we use Student's \( t \)-distribution with \( \nu = n - 1 \) degrees of freedom.

A \( (100 - \alpha)\% \) confidence interval for \( \mu \) is given by:

\( \bar{x} \pm t_{\nu} \times \frac{s}{\sqrt{n}} \)

where \( t_{\nu} \) is the critical value from the \( t \)-distribution tables with \( \nu = n - 1 \) degrees of freedom.

How to Choose Between \( Z \) and \( t \):

1. Is \( \sigma^2 \) known? \( \implies \) Use \( Z \).
2. Is \( \sigma^2 \) unknown and \( n \ge 30 \)? \( \implies \) Use \( Z \) (with \( s \) in place of \( \sigma \)).
3. Is \( \sigma^2 \) unknown, \( n < 30 \), and the parent population is normal? \( \implies \) Use \( t_{n-1} \) (with \( s \)).


5. Confidence Intervals for a Population Proportion \( p \)

Suppose we want to estimate the true proportion \( p \) of a population that possesses a certain characteristic (e.g. voters supporting a candidate).

Let \( X \) be the number of successes in a sample of size \( n \), so \( X \sim B(n, p) \). The sample proportion is:

\( \hat{p} = \frac{X}{n} \)

The sample proportion is an unbiased estimator of \( p \):

\( \text{E}(\hat{p}) = p \quad \text{and} \quad \text{Var}(\hat{p}) = \frac{p(1-p)}{n} \)

For large \( n \) (such that \( np > 5 \) and \( n(1-p) > 5 \)), we can use the normal approximation to calculate a \( (100 - \alpha)\% \) confidence interval for \( p \):

\( \hat{p} \pm z \times \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \)


6. Step-by-Step Worked Example

Problem: A quality control engineer takes a random sample of 10 metal rods produced by a manufacturing process known to yield normally distributed lengths. The lengths (in cm) are measured as follows:

\( 20.4, 20.1, 19.8, 20.5, 20.2, 19.9, 20.0, 20.3, 20.6, 20.2 \)

Calculate a 95% confidence interval for the true mean length \( \mu \) of the rods.

Step 1: Calculate summary statistics
• Sample size: \( n = 10 \)
• Sum of observations: \( \sum x = 202.0 \)
• Sum of squares: \( \sum x^2 = 4081.00 \)

Sample mean:

\( \bar{x} = \frac{\sum x}{n} = \frac{202.0}{10} = 20.20 \text{ cm} \)

Step 2: Calculate the unbiased estimate of variance \( s^2 \)

\( s^2 = \frac{1}{10 - 1} \left( 4081.00 - \frac{(202.0)^2}{10} \right) = \frac{1}{9}(4081.00 - 4080.40) = \frac{0.60}{9} \approx 0.06667 \)

\( s = \sqrt{0.06667} \approx 0.2582 \text{ cm} \)

Step 3: Identify the correct distribution and critical value
Since \( \sigma^2 \) is unknown, \( n = 10 < 30 \), and the population is normally distributed, we use the \( t \)-distribution with \( \nu = 10 - 1 = 9 \) degrees of freedom.
From the percentage points of the \( t \)-distribution, the two-tailed 95% critical value for \( \nu = 9 \) is:

\( t_{9}(0.025) = 2.262 \)

Step 4: Compute the confidence interval

\( \text{CI} = \bar{x} \pm t_{9} \times \frac{s}{\sqrt{n}} \)

\( \text{CI} = 20.20 \pm 2.262 \times \frac{0.2582}{\sqrt{10}} \)

\( \text{CI} = 20.20 \pm 2.262 \times 0.08165 = 20.20 \pm 0.1847 \)

\( [20.015, 20.385] \text{ or } [20.0, 20.4] \text{ cm (to 3 s.f.)} \)

Step 5: Interpretation
We are 95% confident that the true population mean rod length \( \mu \) lies between \( 20.02 \text{ cm} \) and \( 20.38 \text{ cm} \).


7. Common Pitfalls and Exam Tips

Dividing by \( n \) vs \( n - 1 \): Always divide by \( n - 1 \) when calculating the unbiased estimate of the population variance \( s^2 \) from a sample.
Misinterpreting Confidence Intervals: A 95% confidence interval does not mean "there is a 95% probability that \( \mu \) lies in this specific numerical interval". The parameter \( \mu \) is a fixed constant, not a random variable. The correct interpretation is: "If we repeated this sampling process many times, 95% of the calculated intervals would contain the true mean \( \mu \)."
Forgetting to state assumptions: In exam questions, if you use the \( t \)-distribution, ensure you state that the parent population must be normally distributed. If you apply the normal distribution to a non-normal parent population, state that you are relying on the Central Limit Theorem (CLT) because \( n \) is large.


Key Takeaways Summary

• \( \bar{X} \) is an unbiased estimator for \( \mu \), with \( \text{Var}(\bar{X}) = \frac{\sigma^2}{n} \).
• \( S^2 = \frac{1}{n-1}\left(\sum X^2 - \frac{(\sum X)^2}{n}\right) \) is an unbiased estimator for \( \sigma^2 \).
• The Central Limit Theorem enables us to approximate the distribution of \( \bar{X} \) as \( N\left(\mu, \frac{\sigma^2}{n}\right) \) for large \( n \) regardless of the underlying distribution.
• Use \( z \)-values when \( \sigma \) is known or sample size is large (\( n \ge 30 \)).
• Use \( t \)-distribution (\( \nu = n - 1 \)) when \( \sigma \) is unknown, \( n < 30 \), and the parent population is normal.
• Confidence intervals follow the general structure: Estimate \( \pm \) (Critical Value \( \times \) Standard Error).