Frequentist Hypothesis Testing and Bayesian Statistical Inference
Foundations of Statistical Inference: Frequentist vs. Bayesian Paradigms
Core Objective of Inference:
Statistical inference seeks to learn about an underlying, unobservable parameter θ from an observed set of data X.
The fundamental distinction between the frequentist (classical) and Bayesian frameworks lies in the mathematical interpretation and ontological treatment of the parameter θ.
The Frequentist (Classical) Approach:
The parameter θ is modeled as a fixed but unknown constant.
Randomness in frequentist analysis arises exclusively from the data generation process, sampling variability, or experimental noise.
Probabilistic statements describe the long-run behavior of estimators, statistics, or decision procedures across repeated realizations of the dataset X, rather than describing θ directly.
The Bayesian Approach:
The unknown parameter is treated explicitly as a random variable, designated as Θ, with realized or potential values denoted by θ.
Prior Distribution: Before collecting or observing experimental data, beliefs and existing uncertainties regarding Θ are formalized via a prior distribution, denoted PΘ(θ) in the discrete case or fΘ(θ) in the continuous case.
Posterior Distribution: After observing the empirical realization X=x, Bayes' rule updates the prior distribution to yield the posterior distribution, denoted PΘ∣X(θ∣x) or fΘ∣X(θ∣x).
Inference Pipeline: From the posterior distribution, point estimates (such as the mode or mean), credible intervals, and optimal Bayesian decisions are systematically extracted.
Notational Conventions for Bayesian Modeling:
Observed data are represented by the random variable X, taking realization values x.
Unknown parameters are represented by the random variable Θ, taking values θ.
Probability Mass Functions (PMF) for discrete random variables are denoted by PX, whereas Probability Density Functions (PDF) for continuous random variables are denoted by fX.
Conditional PMF and PDF Specifications:
Distribution of X given Θ=θ:
Discrete: PX∣Θ(x∣θ)=P(X=x∣Θ=θ)
Continuous: fX∣Θ(x∣θ)
Distribution of Θ given X=x:
Discrete: PΘ∣X(θ∣x)=P(Θ=θ∣X=x)
Continuous: fΘ∣X(θ∣x)
Joint distribution of (Θ,X):
Discrete: PΘX(θ,x)=P(Θ=θ,X=x)
Continuous: fΘX(θ,x)
Frequentist Hypothesis Testing: Mathematical Framework and Decision Theory
Definition and Real-World Motivation:
Hypothesis testing addresses decision problems with binary outcomes based on stochastic observations.
Practical domains include:
Medicine: Determining whether a novel therapeutic agent is clinically effective or ineffective.
Radar signal processing: Discerning whether an aircraft or target is present in radar echo noise, or whether only ambient noise is received.
Industrial quality control: Evaluating whether a manufacturing process, coin, or machine is fair, calibrated, or defective.
Two Competing Hypotheses:
Null Hypothesis (H0): The default baseline assertion, presumed true until empirical evidence demonstrates substantial incompatibility. Examples: "the drug has no effect", "no aircraft is present", "the coin is fair".
Alternative Hypothesis (H1): The complementary assertion that contradicts H0. Examples: "the drug is effective", "an aircraft is present", "the coin is biased".
Decision Outcomes: Based on data X, the researcher either rejects H0 (accepting H1) or does not reject H0.
Structural Asymmetry of Hypotheses:
H0 and H1 are not treated symmetrically.
Statistical tests are designed primarily to strictly cap and control the probability of erroneously rejecting the null hypothesis H0.
In classical frequentist statistics, H0 and H1 are non-random statements rather than random events. Consequently, expressions of the form P(⋅∣H0) strictly represent "the probability computed under the mathematical model where H0 holds true".
Mathematical Partitioning of the Parameter Space:
Let θ be an unknown parameter belonging to the parameter space Θ.
The parameter space is partitioned into two disjoint subsets, Θ0 and Θ1, such that:
Θ=Θ0∪Θ1Θ0∩Θ1=∅
The hypothesis testing problem is formally posed as:
H0:θ∈Θ0versusH1:θ∈Θ1
Simple vs. Composite Hypotheses:
A hypothesis is classified as simple if its associated parameter set contains exactly one point (θ=θ0).
A hypothesis is classified as composite if its associated parameter set contains multiple points.
By convention, H0 is typically formulated as a simple hypothesis.
Test Statistics, Acceptance Regions, and Rejection Regions:
A statistic is a measurable real-valued function of the data, such as the sample average:
X=n1∑i=1nXi
A test statisticW=W(X1,X2,…,Xn) is the specific functional summary upon which the statistical decision is based.
The acceptance regionA⊂R is the set of test statistic values for which H0 is maintained.
The rejection region (also known as the critical region) is the complementary set R=R∖A.
Decision Rule:W∈A⟹do not reject H0W∈R⟹reject H0
Statistical Errors, Significance Level, and Power
Classification of Decision Outcomes:
Decision Table:
When H0 is true and the decision is "Do not reject H0": Correct decision.
When H0 is true and the decision is "Reject H0": Type I error (false positive).
When H0 is false (H1 is true) and the decision is "Do not reject H0": Type II error (false negative).
When H0 is false (H1 is true) and the decision is "Reject H0": Correct decision.
Type I Error and Significance Level (α):
A Type I error occurs when H0 is rejected despite being true.
For any specific parameter value θ∈Θ0:
P(type I error∣θ)=P(reject H0∣θ)=P(W∈R∣θ)
A statistical procedure is defined as a level-α test (having significance level α) if the probability of committing a Type I error never exceeds α across the entire null set:
P(W∈R∣θ)≤αfor all θ∈Θ0
Typical choices for α include 0.05, 0.01, or 0.001.
Type II Error (β) and Power of a Test:
A Type II error occurs when H0 is accepted (not rejected) when it is false.
Because H1 is generally composite, the probability of a Type II error depends on the specific parameter value θ∈Θ1:
β(θ)=P(accept H0∣θ)=P(W∈A∣θ),θ∈Θ1
The power of the test at θ∈Θ1 is defined as the complementary probability of correctly rejecting a false null hypothesis:
Power(θ)=1−β(θ)=P(W∈R∣θ)
The Fundamental Trade-off Between α and β:
In any sample of fixed size n, it is mathematically impossible to make both α and β arbitrarily small simultaneously.
Shifting the critical decision threshold to reduce α forces the acceptance region A to expand, which invariably inflates β, and vice versa.
Standard statistical practice fixes the maximum allowable Type I error at a predetermined tolerance α and subsequently seeks a test configuration that minimizes β(θ) (maximizing power).
Worked Example: Radar Signal Detection:
Model Formulation: A radar receiver observes X=θ+N, where ambient noise is distributed as N∼N(0,σ2=91).
The underlying state parameter is binary:
θ=0(aircraft absent)θ=1(aircraft present)
The testing problem consists of two simple hypotheses:
H0:θ=0⟹X∼N(0,91)H1:θ=1⟹X∼N(1,91)
Designing a Level-α Decision Rule:
Because higher values of X favor θ=1, the intuitive decision rule rejects H0 when X>c.
The significance level constraint dictates:
α=P(X>c∣H0)=P(N>c)=P(3N>3c)=1−Φ(3c)
Inverting this relationship using the standard normal quantile z1−α:
3c=z1−α⟹c=31z1−α
For α=0.05, utilizing z0.95=1.645:
c=31(1.645)≈0.548
Calculating Type II Error Probability (β):
The probability of missing a present aircraft is:
β=P(X≤c∣H1)=P(1+N≤c)=P(N≤c−1)=Φ(3(c−1))
If an experiment produces 55 heads in 100 tosses, the test statistic falls into the acceptance region.
This observation does not prove that the coin is fair (i.e., that θ=0.5 exactly).
It indicates solely that the data are not statistically incompatible with the null hypothesis at the chosen significance level.
Hence, formal scientific reporting mandates the phrase "fail to reject H0" over "accept H0".
Hypothesis Testing for Normal Means
Classification of Testing Problems for Independent Samples:
Let X1,X2,…,Xn be an independent and identically distributed (i.i.d.) sample from a normal distribution N(μ,σ2), with specified reference mean μ0.
Three distinct hypothesis pairs arise:
Two-sided:H0:μ=μ0versusH1:μ=μ0
One-sided (right-tailed):H0:μ≤μ0versusH1:μ>μ0
One-sided (left-tailed):H0:μ≥μ0versusH1:μ<μ0
Standardized Test Statistics:
When variance σ2 is known:
W=σ/nX−μ0
When variance σ2 is unknown, utilizing the sample variance S2:
W=S/nX−μ0
where:
S2=n−11∑k=1n(Xk−X)2=n−11(∑k=1nXk2−nX2)
Under H0, these statistics represent pivotal quantities with exact standard normal N(0,1) or Student's t(n−1) distributions, enabling exact error computations.
Notation: zp and tp(k) denote the lower p-th quantiles (area p to the left).
Two-Sided Tests (H0:μ=μ0 vs. H1:μ=μ0):
Known σ (z-test):
Rejection criterion: Reject H0 if ∣W∣>z1−2α; do not reject if:
σ/nX−μ0≤z1−2α
Unknown σ (t-test):
Rejection criterion: Reject H0 if ∣W∣>t1−2α(n−1); do not reject if:
∣W∣≤t1−2α(n−1)
Large Samples with Non-Normal Data (n→∞):
By the Central Limit Theorem, W=S/nX−μ0≈N(0,1). The normal critical value z1−2α is used.
Mathematical Duality Between Tests and Confidence Intervals:
The acceptance condition of the two-sided level-α z-test can be algebraically inverted:
σ/nX−μ0≤z1−2α⟺μ0∈[X−z1−2αnσ,X+z1−2αnσ]
Thus, a null hypothesis H0:μ=μ0 is maintained at significance level α if and only if the hypothesized parameter value μ0 lies within the corresponding (1−α) confidence interval.
Type II Error Function for the Two-Sided z-Test:
If the true population mean is μ=μ0, then X∼N(μ,nσ2).
Derivation of β(μ), the probability of failing to reject H0:
β(μ)=P(σ/nX−μ0≤z1−2αμ)β(μ)=P(μ0−z1−2αnσ≤X≤μ0+z1−2αnσμ)β(μ)=P(−z1−2α+σ/nμ0−μ≤σ/nX−μ≤z1−2α+σ/nμ0−μμ)
Because σ/nX−μ∼N(0,1), this evaluates to:
β(μ)=Φ(z1−2α+σ/nμ0−μ)−Φ(−z1−2α+σ/nμ0−μ)
Boundary Behavior and Asymptotics:
At μ=μ0:
β(μ0)=Φ(z1−2α)−Φ(−z1−2α)=(1−2α)−2α=1−α
As the discrepancy ∣μ−μ0∣→∞ or sample size n→∞ (for fixed μ=μ0):
β(μ)→0⟹Power (1−β(μ))→1
Worked Example: Urban Average Height:
Problem: The national average height of adult males is 170cm. To test if a specific city has a divergent average, a sample of n=9 men is measured (assuming normal distributions):
176.2,157.9,160.1,180.9,165.1,167.2,162.9,155.7,166.2
Hypotheses: H0:μ=170 versus H1:μ=170 at α=0.05.
Observed Test Statistic:w=s/nx−μ0=8.25/3165.8−170=2.75−4.2≈−1.53∣w∣≈1.53
Critical Value and Decision:
Quantile from Student's t with n−1=8 degrees of freedom: t0.975(8)≈2.306.
Because ∣w∣=1.53≤2.306, we do not reject H0.
Confidence Interval Verification:
The 95% Student's t confidence interval is:
165.8±2.306(38.25)=165.8±6.34=[159.46,172.14]
Since 170∈[159.46,172.14], the conclusion aligns with the hypothesis test.
One-Sided Tests for the Mean:
Right-Tailed Test (H0:μ≤μ0 vs. H1:μ>μ0):
Large positive values of W=σ/nX−μ0 support H1.
Decision rule: Reject H0 if and only if W>c.
For any μ≤μ0:
P(W>c∣μ)=P(σ/nX−μ>c+σ/nμ0−μμ)≤P(σ/nX−μ>cμ)=1−Φ(c)
The maximum Type I error occurs at the boundary μ=μ0.
Equating 1−Φ(c)=α gives c=z1−α.
Do not reject H0:μ≤μ0 if W≤z1−α; reject otherwise.
Left-Tailed Test (H0:μ≥μ0 vs. H1:μ<μ0):
Do not reject H0:μ≥μ0 if W≥zα=−z1−α; reject otherwise.
Comprehensive Decision Rules for One-Sided Tests:
Right-tailed (H1:μ>μ0, reject for large W):
Normal, σ known: Do not reject if W≤z1−α
Large sample, non-normal: Do not reject if W≤z1−α
Normal, σ unknown: Do not reject if W≤t1−α(n−1)
Left-tailed (H1:μ<μ0, reject for small W):
Normal, σ known: Do not reject if W≥−z1−α
Large sample, non-normal: Do not reject if W≥−z1−α
Normal, σ unknown: Do not reject if W≥−t1−α(n−1)
P-Values: Definition, Interpretation, and Computation
Motivation and Theoretical Definition:
Standard tests deliver a binary output ("reject" or "do not reject"), obscuring whether the data were borderline or decisively extreme.
The P-value is defined as the smallest significance level α at which the observed data would result in rejecting the null hypothesis H0.
Interpretation: The P-value measures the probability, computed assuming H0 is true, of obtaining a test statistic at least as extreme as the observed value w.
Universal Decision Rule:Reject H0 at significance level α⟺P-value≤α
Mathematical Formulas for P-Value Calculation:
Let W be the test statistic and w its observed value from experimental data. Assuming H0 holds at the boundary:
Right-tailed test (H1:μ>μ0):P-value=P(W≥w∣H0)
Left-tailed test (H1:μ<μ0):P-value=P(W≤w∣H0)
Two-sided test (H1:μ=μ0, where the null distribution of W is symmetric around zero):P-value=P(∣W∣≥∣w∣∣H0)=2P(W≥∣w∣∣H0)
Illustrative Calculations:
One-Sided Coin Example: Test H0:θ=21 vs. H1:θ>21. In n=100 tosses, 60 heads are observed.
Two-Sided Height Example: In the city height sample, w≈−1.53 with W∼t(8).
P-value=2P(T≥1.53∣T∼t(8))≈0.165
Because 0.165>0.05, H0 cannot be rejected at the 5% level, nor at any α≤0.165.
Likelihood Ratio Tests (LRT) and Generalized LRT
Sample Likelihood Function:
Let X1,X2,…,Xn be drawn from a distribution parameterized by θ, with observed values x1,x2,…,xn.
For discrete data:
L(x1,…,xn;θ)=PX1…Xn(x1,…,xn;θ)
For continuous data:
L(x1,…,xn;θ)=fX1…Xn(x1,…,xn;θ)
Under i.i.d. sampling, the likelihood decomposes into the product:
L(x1,…,xn;θ)=∏i=1nf(xi;θ)
Likelihood Ratio Test for Simple Hypotheses:
Consider testing simple vs. simple hypotheses: H0:θ=θ0 versus H1:θ=θ1.
The likelihood ratio measures the relative plausibility of the observed sample under the two competing states:
λ(x1,…,xn)=L(x1,…,xn;θ1)L(x1,…,xn;θ0)
Small values of λ signify that the observed data are substantially more probable under θ1 than under θ0.
Decision Rule: For a critical constant c>0 chosen to satisfy the significance level α:
λ<c⟹reject H0λ≥c⟹do not reject H0
Worked Example: Deriving the Radar LRT:
In the radar problem, X=θ+N with N∼N(0,91), testing H0:θ=0 against H1:θ=1.
Constructing the ratio λ(x):
λ(x)=L(x;1)L(x;0)=exp(−29x2+29(x−1)2)=exp(29(1−2x))
Simplifying the test inequality:
λ(x)≥c⟺29(1−2x)≥ln(c)⟺1−2x≥92ln(c)⟺x≤21(1−92ln(c))=:c′
Hence, the LRT is functionally equivalent to maintaining H0 whenever X≤c′, matching the intuitive threshold test.
Generalized Likelihood Ratio Test (GLRT) for Composite Hypotheses:
For general composite hypotheses H0:θ∈Θ0 versus H1:θ∈Θ1, where Θ=Θ0∪Θ1:
Define the restricted and global maximum likelihoods:
l0=supθ∈Θ0L(x1,…,xn;θ)l=supθ∈ΘL(x1,…,xn;θ)
Because Θ0⊂Θ, it follows that 0≤ll0≤1.
The generalized likelihood ratio statistic is:
λ(x1,…,xn)=supθ∈ΘL(x1,…,xn;θ)supθ∈Θ0L(x1,…,xn;θ)∈[0,1]
Decision Mechanism: Select threshold c∈[0,1]:
λ<c⟹reject H0λ≥c⟹do not reject H0
The denominator is the unrestricted maximum likelihood (evaluated at the unconstrained MLE θ^), while the numerator evaluates the likelihood constrained to H0.
Algorithmic Execution of a Hypothesis Test:
1. Formulate H0 and H1 unambiguously within the parameter space.
2. Identify a test statistic W with a known null probability distribution under H0.
3. Determine the structural shape of the rejection region (∣W∣>c, W>c, or W<c) based on H1.
4. Select significance level α and compute critical value c via P(W∈R∣H0)=α.
5. Evaluate the observed statistic w, render the formal decision, and report the P-value.
The Three Operational Steps of Bayesian Inference:
1. Prior Specification: Assign a probability distribution to Θ prior to data collection (fΘ(θ) or PΘ(θ)).
2. Posterior Computation: Upon observing empirical data X=x, evaluate the posterior distribution using Bayes' rule (fΘ∣X(θ∣x) or PΘ∣X(θ∣x)).
3. Estimation and Decision: Extract posterior summaries, including point estimates (MAP, MMSE) and credible intervals.
Bayes' Rule for Conditional Distributions:
Both Variables Discrete:PΘ∣X(θ∣x)=PX(x)PX∣Θ(x∣θ)PΘ(θ)
where the normalizing constant is the marginal PMF:
PX(x)=∑θPX∣Θ(x∣θ)PΘ(θ)
Both Variables Continuous:fΘ∣X(θ∣x)=fX(x)fX∣Θ(x∣θ)fΘ(θ)
where the normalizing constant is the marginal density:
fX(x)=∫−∞∞fX∣Θ(x∣θ)fΘ(θ)dθ
Continuous Parameter Θ, Discrete Data X:fΘ∣X(θ∣x)=PX(x)PX∣Θ(x∣θ)fΘ(θ)
where the denominator integrates over parameter space:
PX(x)=∫−∞∞PX∣Θ(x∣θ)fΘ(θ)dθ
Core Terminology of Bayesian Components:
Prior (PΘ(θ),fΘ(θ)): Represents the probability distribution over Θ prior to data observation.
Likelihood (PX∣Θ(x∣θ),fX∣Θ(x∣θ)): Represents the forward data-generating process as a function of the parameter θ.
Posterior (PΘ∣X(θ∣x),fΘ∣X(θ∣x)): Represents the updated belief distribution over Θ conditional on X=x.
Normalizing Constant (PX(x),fX(x)): The marginal probability of the data; a constant with respect to θ that scales the posterior area/sum to unity.
Worked Example: Political Election Polling:
Frequentist Setup: Estimate the voter support proportion θ∈[0,1] for Party A. A random sample of n=20 voters contains X=6 supporters. Model: X∣θ∼Binomial(20,θ).
Likelihood:
L(θ;6)=(620)θ6(1−θ)14
Log-likelihood:
ℓ(θ)=ln(620)+6ln(θ)+14ln(1−θ)
Differentiating and solving for the maximum:
dθdℓ=θ6−1−θ14=0⟹6(1−θ)=14θ⟹θ^MLE=206=0.3
Incorporating Historical Information:
In the previous election cycle, Party A secured 40% of the vote. We construct a prior distribution concentrated around E[Θ]=0.4.
Model prior as a Beta(6,9) distribution over 0≤θ≤1:
fΘ(θ)=18018θ5(1−θ)8
Deriving the Posterior Distribution:
Invoking Bayes' rule in proportional form (dropping factors independent of θ):
fΘ∣X(θ∣6)∝PX∣Θ(6∣θ)fΘ(θ)fΘ∣X(θ∣6)∝[θ6(1−θ)14]×[θ5(1−θ)8]=θ11(1−θ)22
Recognizing the kernel of a Beta distribution, the posterior is:
Θ∣X=6∼Beta(12,23)
Observing X=2 suppresses posterior density near the boundaries θ=0 and θ=1, centering probability mass in the interior.
Point Estimation in Bayesian Inference: MAP and MMSE
Maximum A Posteriori (MAP) Estimation:
Formal Definition: The MAP point estimate θ^MAP is defined as the mode of the posterior distribution, representing the parameter value that maximizes the posterior density or probability mass:
θ^MAP=argmaxθfΘ∣X(θ∣x)(Θ continuous)θ^MAP=argmaxθPΘ∣X(θ∣x)(Θ discrete)
Computational Simplification:
Because the marginal density fX(x) (the normalizing constant) is strictly positive and invariant to θ:
θ^MAP=argmaxθ[fX(x)fX∣Θ(x∣θ)fΘ(θ)]=argmaxθ[fX∣Θ(x∣θ)fΘ(θ)]
Computing the marginal denominator is unnecessary when solving for the MAP estimate.
Worked MAP Calculation:
Let the parameter have linear prior density fΘ(θ)=2θ for 0≤θ≤1, and observation model X∣Θ=θ∼Geometric(θ).
Assume X=3 is observed. The likelihood is:
PX∣Θ(3∣θ)=θ(1−θ)2
Form the unnormalized posterior product:
g(θ)=PX∣Θ(3∣θ)fΘ(θ)=[θ(1−θ)2](2θ)=2θ2(1−θ)2
Differentiate g(θ) with respect to θ:
g′(θ)=2[2θ(1−θ)2+θ2⋅2(1−θ)(−1)]=4θ(1−θ)[(1−θ)−θ]=4θ(1−θ)(1−2θ)
Critical points on the open interval (0,1) occur exclusively where 1−2θ=0⟹θ=21.
Analysis of the first derivative:
For θ∈(0,21), g′(θ)>0.
For θ∈(21,1), g′(θ)<0.
Boundary values: g(0)=0 and g(1)=0.
The global maximum on [0,1] occurs at:
θ^MAP=21
While the exact posterior is normalized to fΘ∣X(θ∣3)=30θ2(1−θ)2, evaluating the normalizing factor 30 was not required.
Minimum Mean Squared Error (MMSE) Estimation:
Formal Definition: The MMSE estimate (also termed the Bayes estimate or least mean squares estimate), denoted θ^M, is the conditional expectation of the parameter given the data:
θ^M=E[Θ∣X=x]
Optimality Property:θ^M uniquely minimizes the conditional expected squared error:
θ^M=argmincE[(Θ−c)2X=x]
Step-by-Step MMSE Derivation Example:
Consider prior fΘ(θ)=2θ for 0≤θ≤1, with conditional likelihood model:
fX∣Θ(x∣θ)=2θx−θ+1,0≤x≤1
Step 1: Compute the Marginal Density fX(x):fX(x)=∫01fX∣Θ(x∣θ)fΘ(θ)dθ=∫01(2θx−θ+1)(2θ)dθfX(x)=∫01(4xθ2−2θ2+2θ)dθ=[34xθ3−32θ3+θ2]01=34x−32+1=34x+1
Step 2: Construct the Full Posterior Distribution:fΘ∣X(θ∣x)=(4x+1)/3(2θx−θ+1)(2θ)=4x+16θ(2θx−θ+1),0≤θ≤1