∑GateAndNet
PlannerSign Up
INTERMEDIATEFrequently Tested 4 min read 4 views

Statistical Inference: MLE, MAP Estimation, Confidence Intervals & Hypothesis Testing

Maximum Likelihood vs Maximum A Posteriori derivations (Bernoulli/Beta & Gaussian priors), unbiased sample variance Bessel correction (n-1), Z vs t tests, p-values, and Type-I/II errors.

1. Worked MLE & Conjugate MAP Derivations

  1. Bernoulli Coin (kk Heads in nn Flips) with Beta⁡(α,β)\operatorname{Beta}(\alpha, \beta) Prior:
    • MLE: p^MLE=kn\hat{p}_{\text{MLE}} = \frac{k}{n} (if n=3,k=3  ⟹  p^MLE=1.0n=3, k=3 \implies \hat{p}_{\text{MLE}} = 1.0, extreme small-sample overfitting!).
    • MAP with p∼Beta⁡(α,β)∝pα−1(1−p)β−1p \sim \operatorname{Beta}(\alpha, \beta) \propto p^{\alpha-1}(1-p)^{\beta-1}: p^MAP=k+α−1n+α+β−2,E[p∣D]Posterior Mean=k+αn+α+β\hat{p}_{\text{MAP}} = \frac{k + \alpha - 1}{n + \alpha + \beta - 2}, \qquad \mathbb{E}[p \mid D]_{\text{Posterior Mean}} = \frac{k + \alpha}{n + \alpha + \beta} Notice α,β\alpha, \beta act as pseudo-counts (Laplace smoothing corresponds to posterior mean under uniform Beta⁡(1,1)\operatorname{Beta}(1,1)!).
  2. Linear Regression Probabilistic Equivalence:
    • Gaussian noise y∣x∼N(wTx,σ2)y \mid x \sim \mathcal{N}(w^T x, \sigma^2) + Gaussian prior wj∼N(0,τ2)  ⟺  w_j \sim \mathcal{N}(0, \tau^2) \iff L2L_2 Ridge Regression (λ=σ2/τ2\lambda = \sigma^2 / \tau^2).
    • Gaussian noise + Laplace prior p(wj)∝e−∣wj∣/b  ⟺  p(w_j) \propto e^{-|w_j|/b} \iff L1L_1 Lasso Regression!

2. Hypothesis Testing, pp-Values & Test Selection Matrix

Statistical TestDistributional SetupTest Statistic
One/Two-Sample ZZ-TestPopulation variance σ2\sigma^2 known (or large n≥30n \ge 30 via CLT)Z=Xˉ−μ0σ/n∼N(0,1)Z = \frac{\bar{X} - \mu_0}{\sigma / \sqrt{n}} \sim \mathcal{N}(0,1)
Student’s tt-TestGaussian population with σ2\sigma^2 unknown, estimated by S2S^2T=Xˉ−μ0S/n∼tn−1T = \frac{\bar{X} - \mu_0}{S / \sqrt{n}} \sim t_{n-1}
Chi-Square (χ2\chi^2) TestCategorical goodness-of-fit or contingency table independenceχ2=∑(Oi−Ei)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}
One-Way ANOVA (FF-Test)Comparing means across k≥3k \ge 3 groups simultaneouslyF=MSbetweenMSwithinF = \frac{\text{MS}_{\text{between}}}{\text{MS}_{\text{within}}}
Common Exam Mistake

What a pp-Value Is (and Is NOT!): The pp-value is P(test statistic at least as extreme as observed∣H0 is TRUE)P(\text{test statistic at least as extreme as observed} \mid H_0 \text{ is TRUE}) — it is NEVER P(H0 is true∣data)P(H_0 \text{ is true} \mid \text{data})! Similarly, a 95%95\% Frequentist Confidence Interval means 95%95\% of repeated random intervals cover the fixed true θ\theta.

Key Formulas Summary
MLE vs MAP Parameter Estimators
θ^MLE=arg⁡max⁡θ∑i=1nln⁡p(xi∣θ),θ^MAP=arg⁡max⁡θ[∑i=1nln⁡p(xi∣θ)+ln⁡p(θ)]\hat{\theta}_{\text{MLE}} = \arg\max_{\theta} \sum_{i=1}^{n} \ln p(x_i \mid \theta), \qquad \hat{\theta}_{\text{MAP}} = \arg\max_{\theta} \left[ \sum_{i=1}^{n} \ln p(x_i \mid \theta) + \ln p(\theta) \right]
Note: As sample size n -> infinity, prior influence vanishes and theta_MAP -> theta_MLE!
Gaussian MLE Variance (Biased) vs Bessel-Corrected Sample Variance (Unbiased)
σ^MLE2=1n∑i=1n(xi−xˉ)2,S2=1n−1∑i=1n(xi−xˉ)2\hat{\sigma}_{\text{MLE}}^2 = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^2, \qquad S^2 = \frac{1}{n - 1}\sum_{i=1}^{n}(x_i - \bar{x})^2
Note: E[sigma_MLE^2] = ((n-1)/n) * sigma^2 (underestimates variance for small n); E[S^2] = sigma^2!
#Data Science#Statistics#MLE#MAP#Hypothesis Testing#p-Value#Bayes#GATE DA

Practice Questions on This Chapter (2)

Q1GATE DA StatsMCQMEDIUM
+2M • -0.67

A biased coin with Heads probability θ\theta has prior θ∼Beta⁡(2,2)\theta \sim \operatorname{Beta}(2, 2). In n=6n = 6 independent tosses, you observe k=5k = 5 Heads and 11 Tail. What are θ^MLE\hat{\theta}_{\text{MLE}} and θ^MAP\hat{\theta}_{\text{MAP}}?

⚡ Click an option above to verify instantly
Q2GATE DA StatsMCQEASY
+1M • -0.33

In classical Frequentist Hypothesis Testing, Rejecting a True Null Hypothesis (H0H_0) and Failing to Reject a False Null Hypothesis (H0H_0) are respectively called:

⚡ Click an option above to verify instantly
Previous TopicSVD, Eckart-Young Low-Rank Approximation, PSD Matrices & KKT Convex OptimizationNext Topic Data Science Pipelines: EDA, Feature Scaling, OLAP Schemas & SQL Window Functions