Lecture 7 – Inference for a Population Proportion (Complete Study Notes)

l    Lecture 1 – Sample Proportions

• Overarching course aim: introduce Statistics as the science of collecting, analysing & interpreting data.

• Last lecture recap: Central Limit Theorem (CLT), assumption checking, inference for a mean.

• This week’s roadmap

  • Sample proportions

  • Sampling distribution of counts & proportions

  • Confidence intervals for a proportion

  • Hypothesis tests for a proportion

Why move from means to proportions?

• Real-world variables are often binary (yes/no, success/failure) rather than quantitative & normal.

• CLT still provides an approximate normal distribution for the sample mean of Bernoulli trials when nn large.

• Statistical tools always rely on assumptions → must diagnose validity (e.g., normal quantile plot, sample size).

Motivating example – “Mike Promesses” poll

• Needs p=0.5p=0.5 of votes to win.

• Poll: n=200n=200 respondents, p^obs=0.54\hat p_{\text{obs}}=0.54.

• Desired outputs:

  1. 95 % Confidence Interval (CI) for true population proportion pp.

  2. Hypothesis test H<em>0:p0.5H<em>0:p\le 0.5 vs Ha:p>0.5.

• R quick look: prop.test(x = 108, n = 200, p = 0.5, alternative="greater")χ2=1.125,  p=0.1444\chi^2=1.125,\; p=0.1444, CI [0.479,1][0.479,1].

Binomial model (revision)

• Assumptions (7.1):

  1. Fixed number of trials nn.

  2. Two outcomes (success/failure).

  3. Constant success probability pp.

  4. Independent trials.

• PMF: P(X=x)=(nx)px(1p)nx,  x=0,,n.P(X=x)=\binom{n}{x}p^{x}(1-p)^{n-x},\;x=0,\dots,n.

• Moments: μ<em>X=np,  σ2</em>X=np(1p),  σX=np(1p).\mu<em>X=np,\;\sigma^2</em>X=np(1-p),\;\sigma_X=\sqrt{np(1-p)}.

Recognising a binomial

• Whenever we “count how many ### in a random sample of fixed size”, the resulting RV is binomial.

• Examples: number of Australians favouring emission cuts, number of female students in SRS of size 4, etc.

Worked exercise – Australian Open Women final

• Assume p=0.2p=0.2. Sample n=4n=4XB(4,0.2)X\sim B(4,0.2).

  • P(X=0)=0.4096P(X=0)=0.4096 (verified by dbinom).

  • P(X=1)=0.4096P(X=1)=0.4096, full distribution table presented.

• Moments: μ<em>X=0.8,  σ2</em>X=0.64,  σX=0.8\mu<em>X=0.8,\;\sigma^2</em>X=0.64,\;\sigma_X=0.8.

Definition 7.2 – Sample proportion

p^=Xn(a statistic).\hat p=\dfrac{X}{n}\quad(\text{a statistic}).


Lecture 2 – Sampling Distribution of Counts & Proportions

Learning outcomes

• [Ch7-L2-O1] Know the sampling distribution of p^\hat p.

• [Ch7-L2-O2] Understand normal approximation.

Exact distribution of p^\hat p

• If XB(n,p)X\sim B(n,p) then p^=X/n\hat p=X/n takes values 0/n,1/n,,n/n{0/n,1/n,\dots,n/n} with same probabilities P(p^=x/n)=P(X=x).P(\hat p=x/n)=P(X=x).

• Moments:

μ<em>p^=p,\mu<em>{\hat p}=p, σ2</em>p^=p(1p)n,\sigma^2</em>{\hat p}=\dfrac{p(1-p)}{n}, σ<em>p^=p(1p)n.\sigma<em>{\hat p}=\sqrt{\dfrac{p(1-p)}{n}}. • Standard error (unknown pp): SE</em>p^=p^(1p^)n.SE</em>{\hat p}=\sqrt{\dfrac{\hat p(1-\hat p)}{n}}.

Example – Lowy emission-reduction poll

n=1200,  p^obs=0.63.n=1200,\; \hat p_{\text{obs}}=0.63.

• Moments for XX: μ=1200p,  σ=1200p(1p).\mu=1200p,\; \sigma=\sqrt{1200p(1-p)}.

• SE: se=0.63(10.63)12000.01394.\text{se}=\sqrt{\dfrac{0.63(1-0.63)}{1200}}\approx0.01394.

Normal approximation (Proposition 7.3)

• When nn large with np10np\ge 10 and n(1p)10n(1-p)\ge10, then

  • XN(np,np(1p))X\approx N\bigl(np,\,np(1-p)\bigr)

  • p^N(p,p(1p)n).\hat p\approx N\Bigl(p,\,\dfrac{p(1-p)}{n}\Bigr).

• Continuity correction improves accuracy for discrete XX:

P(X<k)=P\bigl(Y<k-0.5\bigr)\text{ for }Y\sim N(np,np(1-p)).

Example – 50 underground tanks

• Assume p=0.25,  n=50p=0.25,\;n=50.

  • μ<em>X=12.5,  σ</em>X=3.062.\mu<em>X=12.5,\;\sigma</em>X=3.062.

  • P(X<10)=P\bigl(Z<\tfrac{10-12.5}{3.062}\bigr)\approx0.2072.

  • Exact binomial: 0.1637; with continuity correction 0.164 – almost identical.

CLT connection

• Bernoulli variables B<em>i0,1B<em>i\in{0,1} with E(B</em>i)=p,Var(Bi)=p(1p).E(B</em>i)=p,Var(B_i)=p(1-p).

• Sample mean Bˉ=p^\bar B=\hat p → CLT ⇒ normal approximation.

Rule-of-thumb (Assumptions 7.2)

• Use normal approximation if both npnp and n(1p)n(1-p) ≥ 10 (or with p^obs\hat p_{\text{obs}} when pp unknown).

Data-science interlude – tidyverse

• Introduced pipe %>%, verbs: filter, mutate, arrange, select, relocate, summarise, group_by, join variants.

• Illustrated using palmerpenguins & tiny datasets (band_members, band_instruments).


Lecture 3 – Confidence Intervals for a Proportion

Learning outcomes

• [Ch7-L3-O1] Know CI formula (Wald).

• [Ch7-L3-O2] Check validity assumptions.

• [Ch7-L3-O3] Recognise common CI pattern.

Wald CI (Definition 7.4)

Given random SRS of size nn with p^<em>obs\hat p<em>{\text{obs}} and CC confidence level, CI</em>C(p)=[p^<em>obs  ±  zp^</em>obs(1p^obs)n],CI</em>C(p)=\Bigl[\hat p<em>{\text{obs}}\;\pm\;z^*\sqrt{\dfrac{\hat p</em>{\text{obs}}(1-\hat p_{\text{obs}})}{n}}\Bigr],

where z<em>z^<em> is the CC quantile of N(0,1)N(0,1) (e.g., z</em>=1.96z^</em>=1.96 for 95 %).

Assumptions

  1. Independent observations (SRS or sampling fraction ≤ 1/101/10 of population).

  2. Approximate normality: np^<em>obs10,  n(1p^</em>obs)10.n\hat p<em>{\text{obs}}\ge10,\;n(1-\hat p</em>{\text{obs}})\ge10.

Political poll worked example

n=2951,p^=0.51n=2951, \hat p=0.51. 95 % CI: [0.492,0.528].[0.492,0.528].

• Interpretation: “We are 95 % confident true Labor support lies between 49.2 % and 52.8 %.”

Additional examples

• Birth-in-spring (108/400) → check np,n(1p)np,n(1-p) before CI.

• Australian Open viewing (49/400) → CI \approx [9%,15.5%].[9\%,15.5\%].

Pattern recognition

• All CIs so far: point estimate  ±  (quantile)×(SE).\text{point estimate} \;\pm\; (\text{quantile})\times(\text{SE}).

• Mean with known σ\sigma: Xˉ±z<em>σn\bar X \pm z^<em>\dfrac{\sigma}{\sqrt n}. • Mean with unknown σ\sigma: Xˉ±t</em>Sn\bar X \pm t^</em>\dfrac{S}{\sqrt n}.

• Proportion: formula above (Wald).

Cautions

• Wald CI can be poor for small nn; alternatives: Wilson, Jeffreys, Agresti-Coull (implemented in binomCI).

• CI margin covers random sampling error only – non-response & bias not captured.

• Avoid over-precision; round sensibly (e.g., 54 % \pm 7 %).


Lecture 4 – Hypothesis Tests for a Proportion

Learning outcomes

• [Ch7-L4-O1] Perform Z-test for proportion.

• [Ch7-L4-O2] Check assumptions.

• [Ch7-L4-O3] Link tests \leftrightarrow confidence intervals.

• [Ch7-L4-O4] Recognise Wald test statistic pattern.

Z-test statistic (Definition 7.5)

To test H<em>0:p=p</em>0H<em>0:p=p</em>0 vs alternative H<em>aH<em>a, use Z=p^p</em>0p<em>0(1p</em>0)n.Z=\dfrac{\hat p - p</em>0}{\sqrt{\dfrac{p<em>0(1-p</em>0)}{n}}}.

If assumptions hold ⇒ ZN(0,1)Z\sim N(0,1) approximately.

Why SE uses p0p_0 not p^\hat p

• Under H<em>0H<em>0 we pretend p=p</em>0p=p</em>0 (worst-case). Therefore variance uses p0p_0.

Assumptions

  1. Independence (SRS & population ≥10×sample).

  2. Approx normality with null value: np<em>010,  n(1p</em>0)10.np<em>0\ge10,\;n(1-p</em>0)\ge10.

Worked examples

  1. Births in spring (108/400): - p<em>0=0.25p<em>0=0.25, one-sided Ha:p>0.25.

    • zobs=0.923,  p=0.178z_{\text{obs}}=0.923,\; p=0.178 → fail to reject; no evidence.

  2. Voting intention change 2013 vs 2016: - n=2951,p0=0.465,p^=0.51n=2951, p_0=0.465, \hat p=0.51, two-sided.

    • zobs=4.901,p9.5×107z_{\text{obs}}=4.901, p\approx9.5\times10^{-7} → very strong evidence of change.

  3. TV ratings (49/400) vs p<em>0=0.0688p<em>0=0.0688: - z</em>obs=4.243,p=2.2×105z</em>{\text{obs}}=4.243, p=2.2\times10^{-5}.

    • 95 % CI [0.090,0.155][0.090,0.155] excludes 0.0688 ⇒ same conclusion – MATH1041 students differ.

Relationship test \leftrightarrow CI (Proposition 7.4)

• For two-sided tests at level α\alpha, rejecting H0H_0 ⇔ null value outside 100(1α)%100(1-\alpha)\% CI.

• One-sided tests correspond to one-sided CIs.

Wald statistic pattern

Test statistic=estimatorhypothesised valueSE.\text{Test statistic}=\dfrac{\text{estimator}-\text{hypothesised value}}{SE}.

Applies to Z-tests (mean or proportion) & t-tests (when σ\sigma unknown).


Continuity Correction Summary

• Used when approximating discrete binomial by continuous normal.

• Rule: replace integer cutoff kk with k±0.5k\pm0.5 depending on inequality.

• Greatly improves tail probability accuracy (demonstrated with tank example).


Keywords & Take-away Concepts

• Proportion, sample proportion p^\hat p.

• Binomial distribution & parameters (n,p)(n,p).

• Sampling distribution & CLT.

• Normal approximation criteria np,n(1p)10np, n(1-p)\ge10.

• Standard error SEp^SE_{\hat p}.

• Wald confidence interval.

• Z-test for a single proportion.

• Continuity correction.

• Tidyverse data-wrangling verbs (filter, mutate, …).


Practical R Commands Cheat-Sheet

• Compute exact binomial prob.: dbinom(x,n,p); cumulative pbinom(k,n,p).

• Normal approx: pnorm(value, mean, sd) or qnorm(prob) for quantiles.

prop.test(x,n,p0, alternative="two.sided", conf.level=0.95, correct=TRUE) – gives CI & test (with continua­­ty-corr χ2\chi^2).

binom.test(x,n,p=p0) – exact binomial test & exact CI.

• Standard CI by hand:

se <- sqrt(p_obs*(1-p_obs)/n)
  ci <- p_obs + c(-1,1)*z_star*se

Common Pitfalls & Best Practices

• Do NOT apply normal approximation when npnp or n(1p)n(1-p) < 10. Use exact binomial methods instead.

• Interpret CIs in context; avoid overstating precision.

• Report assumptions explicitly (independence, sampling design, sample size adequacy).

• Remember CI ≠ probability interval for parameter; 95 % refers to long-run coverage.

• Wald CI unreliable for extreme p^\hat p or small nn → prefer Wilson/Agresti-Coull.


Connections to Further Topics

• Two-sample comparisons of proportions will extend these ideas (not covered here).

χ2\chi^2 tests of independence generalise to multi-category tables.

• Generalised linear models (logistic regression) model proportions with covariates.


Self-Reflection Prompts (Exercise 7.2)

• Which part of the inference workflow (formulating H<em>0H<em>0/H</em>aH</em>a, checking assumptions, computing SESE) still feels unclear?

• Identify a binary variable in your discipline and outline how you would design a study, compute p^\hat p, draw a CI, and test a claim.