Probabilistic Methods

Danylo Bevziuk
Index 45564 · Basic

List 8Statistical Inference

LLN, CLT, confidence intervals, hypothesis tests

Law of Large Numbers

Flip a fair coin repeatedly and track the running relative frequency of heads after each flip. What happens to the relative frequency as the number of flips grows? State the Law of Large Numbers precisely.

Law of Large Numbers — coin

Relative frequency of heads converges to p = 0.5 as the number of flips grows.

Setup

Let X1,X2,X_1, X_2, \ldots be i.i.d. Bernoulli(p) random variables (1 = heads, 0 = tails). The running relative frequency after n flips is the sample mean.

Xˉn=X1+X2++Xnn\bar{X}_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
Law of Large Numbers (LLN)

The Weak LLN states that for any ε>0\varepsilon > 0, the probability that the sample mean deviates from the true expected value by more than ε\varepsilon goes to zero as nn \to \infty.

Pr ⁣(Xˉnμ>ε)0as n\Pr\!\left(|\bar{X}_n - \mu| > \varepsilon\right) \to 0 \quad \text{as } n \to \infty
Application to coin flips

For a fair coin, μ=E[X]=p=0.5\mu = E[X] = p = 0.5. The simulator above draws from Bernoulli(0.5) and plots Xˉn\bar{X}_n vs nn. Watch the running frequency bounce wildly at first, then stabilize near the red reference line at 0.5.

Law of Large Numbers — coin

Relative frequency of heads converges to p = 0.5 as the number of flips grows.

Interpretation

The LLN guarantees convergence in probability, not almost-sure equality for any finite n. Early fluctuations are large; they shrink as 1/n1/\sqrt{n}. The LLN is the theoretical foundation for using observed frequencies to estimate true probabilities.

Answer
As nn \to \infty, XˉnPμ=0.5\bar{X}_n \xrightarrow{P} \mu = 0.5.
Explanation tip: The LLN applies to any sequence of i.i.d. random variables with finite expectation, not just Bernoulli.

Sample Size vs Number of Samples

A simulation draws R independent samples of size n from Bernoulli(p=0.5) and records each sample proportion p^\hat{p}. Investigate separately: (a) what happens to the histogram shape and spread when you increase n (holding R fixed), and (b) what happens when you increase R (holding n fixed).

  1. a)(a) Fix R = 500. Compare histograms for n = 10, 50, 200. Describe the change in center, spread, and shape.
  2. b)(b) Fix n = 50. Compare histograms for R = 50, 500, 5000. Describe the change.
  3. c)(c) Which parameter controls statistical precision of the estimator, and which controls the smoothness of the simulation picture?
Sampling distribution of p̂

Mean of estimates ≈ 0.500. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Effect of larger n (sample size)

Increasing n reduces the standard error of p^\hat{p}. The histogram of p^\hat{p} values becomes narrower and more concentrated around the true p. This reflects real statistical precision: you are collecting more data per estimate.

SE(p^)=p(1p)nlarger nsmaller SESE(\hat{p}) = \sqrt{\frac{p(1-p)}{n}} \quad \Rightarrow \quad \text{larger } n \Rightarrow \text{smaller SE}
Sampling distribution of p̂

Mean of estimates ≈ 0.502. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Effect of larger R (number of repetitions)

Increasing R does NOT change the spread of the histogram; it only makes the histogram smoother and less ragged. You are simply drawing more replications to better approximate the theoretical sampling distribution. R is a simulation parameter, not a data parameter.

Sampling distribution of p̂

Mean of estimates ≈ 0.503. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Key distinction

n governs statistical precision (real-world quantity). R governs simulation quality (computational quantity). Confusing the two is a common mistake: running more simulations does not make your estimator more accurate in practice.

Answer

Larger n narrows the sampling distribution (better real estimates). Larger R smooths the histogram (better picture of the distribution).

Sampling Distribution of a Proportion

Let X1,,XnX_1, \ldots, X_n be i.i.d. Bernoulli(p). Define the sample proportion p^=1ni=1nXi\hat{p} = \frac{1}{n}\sum_{i=1}^n X_i. Derive the mean and standard error of p^\hat{p}, then use a simulator to verify that the sampling distribution is approximately normal for large n.

Sampling distribution of p̂

Mean of estimates ≈ 0.398. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Mean of $\hat{p}$

Because E[Xi]=pE[X_i] = p for each i, linearity of expectation gives the mean of the sampling distribution.

E[p^]=E ⁣[1ni=1nXi]=1nnp=pE[\hat{p}] = E\!\left[\frac{1}{n}\sum_{i=1}^n X_i\right] = \frac{1}{n} \cdot n \cdot p = p
Variance and Standard Error of $\hat{p}$

Since the XiX_i are independent with Var(Xi)=p(1p)\mathrm{Var}(X_i) = p(1-p), the variance of the sum scales by 1/n21/n^2.

Var(p^)=p(1p)n,SE(p^)=p(1p)n\mathrm{Var}(\hat{p}) = \frac{p(1-p)}{n}, \qquad SE(\hat{p}) = \sqrt{\frac{p(1-p)}{n}}
Normal approximation via CLT

By the Central Limit Theorem, for large n the standardized p^\hat{p} is approximately standard normal.

p^pp(1p)/ndN(0,1)as n\frac{\hat{p} - p}{\sqrt{p(1-p)/n}} \xrightarrow{d} N(0,1) \quad \text{as } n \to \infty
Simulator verification

With p = 0.4, n = 100, the theoretical SE = 0.40.6/100=0.049\sqrt{0.4 \cdot 0.6 / 100} = 0.049. Run the simulator and check that the histogram spread matches this value and that the bell shape is visible.

SE=0.4×0.6100=0.00240.049SE = \sqrt{\frac{0.4 \times 0.6}{100}} = \sqrt{0.0024} \approx 0.049
Sampling distribution of p̂

Mean of estimates ≈ 0.398. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Rule of thumb

The normal approximation is reliable when np10np \geq 10 and n(1p)10n(1-p) \geq 10. Here 100×0.4=40100 \times 0.4 = 40 and 100×0.6=60100 \times 0.6 = 60, both well above 10.

Answer
E[p^]=pE[\hat{p}] = p,   SE(p^)=p(1p)/n0.049\;SE(\hat{p}) = \sqrt{p(1-p)/n} \approx 0.049 for p=0.4,n=100p=0.4, n=100.

Central Limit Theorem

Let X1,,XnX_1, \ldots, X_n be i.i.d. with mean μ\mu and finite variance σ2\sigma^2. State the Central Limit Theorem and illustrate it by drawing repeated samples from a non-normal (exponential) source and plotting the distribution of sample means.

Central Limit Theorem — sample means of Exp(1)

Mean of estimates ≈ 0.994. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Statement of the CLT

No matter the shape of the population distribution (provided it has finite mean and variance), the standardized sample mean converges in distribution to the standard normal as nn \to \infty.

Zn=Xˉμσ/ndN(0,1)Z_n = \frac{\bar{X} - \mu}{\sigma / \sqrt{n}} \xrightarrow{d} N(0,1)
Equivalently

The sample mean Xˉ\bar{X} is approximately normal for large n, regardless of the shape of the population.

XˉN ⁣(μ,σ2n)\bar{X} \approx N\!\left(\mu,\, \frac{\sigma^2}{n}\right)
Non-normal source: Exponential

An Exponential(λ=1\lambda=1) distribution is right-skewed with μ=1\mu = 1 and σ=1\sigma = 1. Individual values are nowhere near normal. But the simulator draws n = 30 values, computes their mean, and repeats R = 600 times.

Central Limit Theorem — sample means of Exp(1)

Mean of estimates ≈ 1.011. Larger n → narrower (smaller spread); the shape approaches a normal curve.

What to observe

Even with n = 30, the histogram of Xˉ\bar{X} is approximately bell-shaped and centered at μ=1\mu = 1. The spread is σ/n=1/300.183\sigma/\sqrt{n} = 1/\sqrt{30} \approx 0.183.

σXˉ=σn=1300.183\sigma_{\bar{X}} = \frac{\sigma}{\sqrt{n}} = \frac{1}{\sqrt{30}} \approx 0.183
Practical importance

The CLT is why so many statistical procedures (z-tests, t-tests, confidence intervals) work even when the data are not normally distributed. The normality is in the estimator, not the raw data.

Answer
For i.i.d. data with finite μ\mu and σ2\sigma^2: XˉN(μ,σ2/n)\bar{X} \approx N(\mu,\, \sigma^2/n) for large nn, regardless of the population shape.

Confidence Intervals for a Proportion

You observe p^\hat{p} from n = 100 Bernoulli trials. Construct a 95% confidence interval for p. Interpret what "95% confidence" means using a simulation that generates many such intervals.

95% confidence intervals for a proportion

Empirical coverage ≈ 95% (target 95%). The vertical line is the true p = 0.5; red intervals miss it.

Wald 95% CI formula

Using the normal approximation and the fact that the 97.5th percentile of N(0,1) is 1.96, the two-sided 95% CI is:

p^±1.96p^(1p^)n\hat{p} \pm 1.96\,\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}
Width of the interval

The total width of the 95% CI depends on p^\hat{p} and n. The maximum width (over p) occurs at p=0.5p = 0.5.

W=2×1.96p^(1p^)n1.96nW = 2 \times 1.96\,\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \leq \frac{1.96}{\sqrt{n}}
Simulation-based interpretation

Run the confidence simulator: for each of many simulations, a fresh p^\hat{p} is drawn and its 95% CI plotted. Green intervals contain the true p = 0.5; red ones miss it. About 95% should be green.

95% confidence intervals for a proportion

Empirical coverage ≈ 98% (target 95%). The vertical line is the true p = 0.5; red intervals miss it.

Correct interpretation

A 95% CI does NOT mean "there is a 95% probability that p is in this interval." The true p is fixed. The interval is random. The correct statement: if we repeated this procedure many times, 95% of the resulting intervals would contain the true p.

Effect of changing n

Increasing n from 100 to 400 cuts the interval width roughly in half (since width 1/n\propto 1/\sqrt{n}). You need 4 times as much data to halve the margin of error.

n=400:  W1.96400=1.9620=0.098n = 400: \; W \approx \frac{1.96}{\sqrt{400}} = \frac{1.96}{20} = 0.098
Answer
95% CI: p^±1.96p^(1p^)/n\hat{p} \pm 1.96\sqrt{\hat{p}(1-\hat{p})/n}. For n=100, p^=0.5\hat{p}=0.5: (0.402,0.598)(0.402,\, 0.598).

Confidence Intervals for a Mean

You observe a random sample of size n with sample mean xˉ\bar{x} and sample standard deviation s. Construct a confidence interval for the population mean μ\mu. When should you use a t-distribution instead of a normal, and why?

95% confidence intervals for a proportion

Empirical coverage ≈ 95% (target 95%). The vertical line is the true p = 0.5; red intervals miss it.

CI when $\sigma$ is known

If the population standard deviation σ\sigma is known (rare in practice), use the z-based interval.

xˉ±zα/2σn\bar{x} \pm z_{\alpha/2}\,\frac{\sigma}{\sqrt{n}}
CI when $\sigma$ is unknown — the t-interval

In practice σ\sigma is unknown and estimated by s. Replacing σ\sigma with s introduces extra variability, which the t-distribution accounts for. With degrees of freedom ν=n1\nu = n-1:

xˉ±tn1,α/2sn\bar{x} \pm t_{n-1,\,\alpha/2}\,\frac{s}{\sqrt{n}}
Why t has heavier tails

The t-distribution with ν\nu degrees of freedom is wider than N(0,1). For small n, tn1,0.025t_{n-1, 0.025} can be much larger than 1.96, leading to a wider (more honest) interval. As nn \to \infty, tνN(0,1)t_{\nu} \to N(0,1).

t9,0.0252.262,t29,0.0252.045,t,0.025=1.960t_{9,\,0.025} \approx 2.262, \quad t_{29,\,0.025} \approx 2.045, \quad t_{\infty,\,0.025} = 1.960
When normality of data matters

For large n the CLT makes the t-interval valid regardless of the data distribution. For small n, the t-interval requires approximately normal data. The interval is more sensitive to skewness when n is small.

Confidence simulator analogy

The same coverage idea from Problem 8.5 applies: run the confidence simulator to see that about 95% of t-intervals contain the true mean when the data are normal.

95% confidence intervals for a proportion

Empirical coverage ≈ 93% (target 95%). The vertical line is the true p = 0.5; red intervals miss it.

Answer
Use xˉ±tn1,0.025s/n\bar{x} \pm t_{n-1,\,0.025}\,s/\sqrt{n}. For small n, t-critical values exceed 1.96; for n30n \geq 30 the difference is negligible.
Explanation tip: For proportions we used z because the variance is a known function of p. For means we use t because σ\sigma must be estimated.

Hypothesis Testing: Coin Fairness

You flip a coin 100 times and observe 61 heads. Test H0:p=0.5H_0: p = 0.5 vs H1:p0.5H_1: p \neq 0.5 at significance level α=0.05\alpha = 0.05 using (a) a simulation-based p-value and (b) a z-test. Interpret the result.

Sampling distribution of p̂

Mean of estimates ≈ 0.498. Larger n → narrower (smaller spread); the shape approaches a normal curve.

State the hypotheses

The null hypothesis is that the coin is fair; the alternative is two-sided (coin could be biased either way).

H0:p=0.5,H1:p0.5H_0: p = 0.5, \qquad H_1: p \neq 0.5
Observed test statistic

The observed proportion is p^=61/100=0.61\hat{p} = 61/100 = 0.61. Under H0H_0, the standard error is computed using p0=0.5p_0 = 0.5.

p^=0.61,SE0=0.5×0.5100=0.05\hat{p} = 0.61, \quad SE_0 = \sqrt{\frac{0.5 \times 0.5}{100}} = 0.05
Simulation-based p-value

Use the simulator to generate 800 samples of size 100 from Bernoulli(0.5) (the null distribution). The p-value is the fraction of simulated p^\hat{p} values at least as extreme as 0.61.

p-value=PrH0(p^0.50.610.5)=PrH0(p^0.39 or p^0.61)\text{p-value} = \Pr_{H_0}(|\hat{p} - 0.5| \geq |0.61 - 0.5|) = \Pr_{H_0}(\hat{p} \leq 0.39 \text{ or } \hat{p} \geq 0.61)
Sampling distribution of p̂

Mean of estimates ≈ 0.499. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Analytical z-test

Standardize the observed p^\hat{p} under H0H_0 to get a z-score, then find the two-tailed p-value from the standard normal.

z=p^p0SE0=0.610.500.05=2.20z = \frac{\hat{p} - p_0}{SE_0} = \frac{0.61 - 0.50}{0.05} = 2.20
p-value from z

The two-tailed p-value is 2Φ(z)2\Phi(-|z|) where Φ\Phi is the standard normal CDF.

p-value=2Φ(2.20)2×0.0139=0.0278\text{p-value} = 2\,\Phi(-2.20) \approx 2 \times 0.0139 = 0.0278
Decision and interpretation

Since 0.0278<0.050.0278 < 0.05 we reject H0H_0 at the 5% level. There is statistically significant evidence that the coin is not fair. However, statistical significance does not imply practical significance: 61% vs 50% may or may not be meaningful depending on context.

Answer
z=2.20z = 2.20, p-value 0.028<0.05\approx 0.028 < 0.05. Reject H0H_0; evidence of bias.
Explanation tip: The simulation and analytical p-values should agree closely for large n due to the CLT.

Chi-Square Goodness-of-Fit Test

Roll a six-sided die 120 times and observe the counts: [18, 22, 17, 25, 19, 19]. Test whether the die is fair using a chi-square goodness-of-fit test at α=0.05\alpha = 0.05.

Die rolls — empirical vs theoretical
Hypotheses

Under the null, each face has probability 1/6; the expected count for each face is Ei=120/6=20E_i = 120/6 = 20.

H0:p1=p2==p6=16,H1:at least one pi16H_0: p_1 = p_2 = \cdots = p_6 = \tfrac{1}{6}, \qquad H_1: \text{at least one } p_i \neq \tfrac{1}{6}
Chi-square statistic

Compute the chi-square test statistic by summing the squared deviations of observed from expected, divided by expected.

D=i=16(OiEi)2EiD = \sum_{i=1}^{6} \frac{(O_i - E_i)^2}{E_i}
Numerical calculation

With observed counts [18, 22, 17, 25, 19, 19] and expected 20 for each:

D=(1820)220+(2220)220+(1720)220+(2520)220+(1920)220+(1920)220D = \frac{(18-20)^2}{20} + \frac{(22-20)^2}{20} + \frac{(17-20)^2}{20} + \frac{(25-20)^2}{20} + \frac{(19-20)^2}{20} + \frac{(19-20)^2}{20}
Result

Summing the terms: 4/20+4/20+9/20+25/20+1/20+1/20=44/20=2.24/20 + 4/20 + 9/20 + 25/20 + 1/20 + 1/20 = 44/20 = 2.2.

D=4+4+9+25+1+120=4420=2.2D = \frac{4+4+9+25+1+1}{20} = \frac{44}{20} = 2.2
Null distribution: $\chi^2(k-1)$

Under H0H_0, D follows approximately a chi-square distribution with k1=5k - 1 = 5 degrees of freedom. The critical value at α=0.05\alpha = 0.05 is χ5,0.052=11.07\chi^2_{5,\,0.05} = 11.07.

Dχ2(5) under H0,χ5,0.052=11.07D \sim \chi^2(5) \text{ under } H_0, \qquad \chi^2_{5,\,0.05} = 11.07
Decision

Since D=2.2<11.07D = 2.2 < 11.07, we fail to reject H0H_0. The data are consistent with a fair die. Use the die simulator to see what typical D values look like from a fair die.

Die rolls — empirical vs theoretical
Simulation check

You can also simulate D under H0H_0 by rolling a fair die 120 times, computing D, and repeating thousands of times. The resulting histogram should match χ2(5)\chi^2(5), confirming the theoretical result.

Answer
D=2.2<χ5,0.052=11.07D = 2.2 < \chi^2_{5,\,0.05} = 11.07. Fail to reject H0H_0; no evidence against fairness.

Comparing Two Groups: Permutation Test

Group A (n=20): mean = 52.3, Group B (n=20): mean = 47.8. The observed difference in means is 4.5. Test whether this difference is statistically significant using a permutation test, and construct a 95% CI for the difference in population means.

Permutation test logic

Under the null hypothesis H0:μA=μBH_0: \mu_A = \mu_B, all group labels are exchangeable. We can shuffle the 40 observations between the two groups, recompute the mean difference, and repeat many times to build the null distribution.

H0:μAμB=0H1:μAμB0H_0: \mu_A - \mu_B = 0 \qquad H_1: \mu_A - \mu_B \neq 0
Step 1 — compute observed statistic

The observed test statistic is the difference in sample means.

Tobs=XˉAXˉB=52.347.8=4.5T_{\text{obs}} = \bar{X}_A - \bar{X}_B = 52.3 - 47.8 = 4.5
Step 2 — build the permutation null distribution

Pool all 40 values. For each of B = 5000 permutations: randomly assign 20 to "group A" and 20 to "group B", compute T=XˉAXˉBT^* = \bar{X}^*_A - \bar{X}^*_B. The collection {T1,,T5000}\{T^*_1, \ldots, T^*_{5000}\} approximates the null distribution of the test statistic.

Step 3 — compute the p-value

Count the fraction of permuted differences at least as extreme as the observed value (two-tailed).

p-value=#{TbTobs}B\text{p-value} = \frac{\#\{|T^*_b| \geq |T_{\text{obs}}|\}}{B}
Step 4 — two-sample t CI for the mean difference

Assuming approximately normal data (or invoking the CLT), a 95% CI uses the Welch t-approximation with pooled standard error.

(XˉAXˉB)±tν,0.025sA2nA+sB2nB(\bar{X}_A - \bar{X}_B) \pm t_{\nu,\,0.025} \cdot \sqrt{\frac{s_A^2}{n_A} + \frac{s_B^2}{n_B}}
Advantages of the permutation approach

The permutation test makes no distributional assumptions beyond exchangeability under H0H_0. It is especially valuable for small samples or non-normal data. The t-based CI is complementary: it quantifies the magnitude and uncertainty of the difference.

Interpretation

If the permutation p-value is below α=0.05\alpha = 0.05, the observed difference is unlikely under exchangeability — evidence that the groups differ. The CI tells us the plausible range of the true difference μAμB\mu_A - \mu_B.

Answer
Tobs=4.5T_{\text{obs}} = 4.5. Compare to permutation null distribution; if p-value <0.05< 0.05, reject H0H_0. Report 95% CI: 4.5±tν,0.025sA2/nA+sB2/nB4.5 \pm t_{\nu,0.025}\sqrt{s_A^2/n_A + s_B^2/n_B}.
Explanation tip: The permutation test p-value and the Welch t-test p-value are usually similar; differences arise with small n or heavy tails.

Final Investigation: Complete Statistical Framework

Design and carry out a complete statistical investigation. Starting from a random experiment of your choice, work through every stage of the inferential process: from defining the experiment and identifying parameters, through data collection, estimation, confidence intervals, and hypothesis testing, to a careful final interpretation.

Sampling distribution of p̂

Mean of estimates ≈ 0.498. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Step 1 — State the random experiment

Clearly describe the data-generating process. Identify the population, the sampling mechanism, and the outcome variable. Example: "We recruit 80 visitors to a website and record whether each one clicks a call-to-action button (1) or not (0)." State what makes the outcomes random and whether independence is plausible.

Step 2 — Identify what is fixed vs random

Separate the fixed unknowns (parameters) from the random quantities (statistics). The true click probability p is a fixed but unknown parameter. The sample proportion p^\hat{p} is a random variable that varies across repetitions of the experiment.

p=fixed, unknown parameterp^=number of clicksn=random estimatorp = \text{fixed, unknown parameter} \qquad \hat{p} = \frac{\text{number of clicks}}{n} = \text{random estimator}
Step 3 — Collect or generate data

Obtain the data. For a simulation, draw n = 80 Bernoulli(p) values. For a real study, collect observations from the population. Record nn, the individual outcomes, and any relevant covariates. Check for obvious data quality issues (missing values, implausible entries).

Sampling distribution of p̂

Mean of estimates ≈ 0.498. Larger n → narrower (smaller spread); the shape approaches a normal curve.

Step 4 — Compute estimators

Calculate point estimates of the parameters of interest. Verify their properties: unbiasedness (E[p^]=pE[\hat{p}] = p), standard error, and consistency (SE 0\to 0 as nn \to \infty).

p^=i=1nXin,SE(p^)=p^(1p^)n\hat{p} = \frac{\sum_{i=1}^n X_i}{n}, \qquad SE(\hat{p}) = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}
Step 5 — Build a confidence interval

Construct a 95% CI for the parameter using the appropriate method (Wald z-interval for proportions; t-interval for means). State it in plain language: "We are 95% confident the true click rate is between a% and b%."

95% CI: p^±1.96p^(1p^)n\text{95\% CI: } \hat{p} \pm 1.96\,\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}
Step 6 — Run a hypothesis test

State the null and alternative hypotheses, choose α\alpha (usually 0.05), compute the test statistic and p-value, and state the decision. Example: test H0:p=0.5H_0: p = 0.5 vs H1:p0.5H_1: p \neq 0.5.

z=p^0.50.50.5/n,p-value=2Φ(z)z = \frac{\hat{p} - 0.5}{\sqrt{0.5 \cdot 0.5 / n}}, \qquad \text{p-value} = 2\,\Phi(-|z|)
Step 7 — Interpret with appropriate caution

Draw conclusions that are consistent with both the CI and the hypothesis test. Address four key questions: (1) Is the result statistically significant? (2) Is it practically meaningful? (3) What are the limitations (sample size, non-randomness, confounding)? (4) What would you do next?

Connecting the pieces

The LLN guarantees your estimate is close to the truth for large n. The CLT justifies the normal-based CI and z-test. The CI tells you precision; the test tells you whether chance alone could explain the result. Neither replaces subject-matter judgment.

XˉnμLLNXˉN ⁣(μ,σ2n)CLTCI and z-testinference\underbrace{\bar{X}_n \to \mu}_{\text{LLN}} \quad \Longrightarrow \quad \underbrace{\bar{X} \approx N\!\left(\mu, \frac{\sigma^2}{n}\right)}_{\text{CLT}} \quad \Longrightarrow \quad \underbrace{\text{CI and z-test}}_{\text{inference}}
Common pitfalls to avoid

Do not say "the probability that p is in the CI is 95%" (p is not random). Do not equate statistical significance with practical importance. Do not ignore multiple testing. Do not extrapolate beyond the sampled population. Report effect sizes and CIs, not just p-values.

Answer
A complete investigation requires: stating the experiment, identifying parameters, collecting data, computing p^\hat{p} and SE, building the 95% CI p^±1.96SE\hat{p} \pm 1.96\,SE, testing H0H_0 with a z or t statistic, and interpreting results in context.
Explanation tip: This capstone unifies all topics from Section 8. Every real data analysis follows these seven steps, though not always in strict order.