Knowledge / Artificial Intelligence and Data Science / Statistical inference and estimation

Statistical inference and estimation

Artificial Intelligence and Data Science (B.E./B.Tech) · Mathematics and statistics for AI · free study notes for exams, placements and interviews

In short

Statistical inference is the business of drawing conclusions about an unknown population parameter from a finite sample, and estimation is the half of it that produces a number (a point estimate) or a range (an interval estimate) for that parameter along with a stated uncertainty. It underpins everything a data scientist reports — a click-through rate, a model coefficient, a churn probability, a measured accuracy — because each is computed from a sample and therefore carries sampling error. Indian university syllabi (AICTE model curriculum for AI&DS, UGC CBCS statistics papers) and GATE DA/CS examine estimator properties, maximum likelihood, the Cramér–Rao bound and confidence intervals as standard; placement tests at Mu Sigma, Fractal, ZS Associates, Tiger Analytics, Flipkart, Swiggy, Jio and the analytics arms of TCS/Infosys/Wipro ask for the standard error of a mean or proportion and the meaning of a 95% interval almost routinely. The topic sits upstream of hypothesis testing (which uses these sampling distributions to decide), and here the focus is on *constructing and judging estimators*, not on testing claims.

Explained

Population, sample and the logic of inference

Properties of a good estimator

Let θ̂ estimate θ.

Methods of point estimation

  1. Method of moments (MoM): equate the first k sample moments to the population moments and solve for the k parameters. Simple, needs no likelihood, but can give estimates outside the parameter space and is usually less efficient.
  2. Maximum likelihood estimation (MLE):
    • Likelihood L(θ) = ∏ f(xᵢ|θ) treated as a function of θ with data fixed; maximise ℓ(θ) = ln L(θ).
    • Steps: write L → take ln → differentiate (score function) → set dℓ/dθ = 0 → solve → verify d²ℓ/dθ² < 0 → check boundary cases.
    • Invariance: if θ̂ is the MLE of θ, g(θ̂) is the MLE of g(θ).
    • MLEs may be biased (σ̂²_MLE = Σ(xᵢ−x̄)²/n) and may not exist in closed form (logistic regression, Gaussian mixtures → solved numerically by Newton–Raphson, IRLS or EM).
    • Minimising cross-entropy loss in a neural classifier *is* maximum likelihood for a categorical model; least squares is MLE under Gaussian errors.
  3. Least squares: minimise Σ(yᵢ − ŷᵢ)²; by the Gauss–Markov theorem OLS is BLUE (best linear unbiased) without any normality assumption.
  4. Bayesian point estimates: posterior mean/median/mode (MAP); MAP = MLE plus a penalty from the prior (Gaussian prior ⇒ L2/ridge, Laplace prior ⇒ L1/lasso). Detail belongs to the Bayesian topic.
  5. Method of maximum entropy, minimum chi-square, M-estimation (Huber): alternatives used when robustness or constraints matter.

Fisher information and the Cramér–Rao lower bound

Interval estimation (confidence intervals)

Sample size, reporting and Indian practice

Key points

Formulas and examples

Sample mean x̄ = (1/n) Σxᵢ — unbiased for μ (same units as data)
Sample variance s² = Σ(xᵢ − x̄)² / (n − 1) — unbiased for σ² (units = data²)
Standard error of the mean SE(x̄) = σ/√n, estimated by s/√n
Standard error of a proportion SE(p̂) = √(p̂(1 − p̂)/n), p̂ dimensionless (0–1)
Bias(θ̂) = E[θ̂] − θ; MSE(θ̂) = Var(θ̂) + [Bias(θ̂)]²
Likelihood L(θ) = ∏ᵢ f(xᵢ|θ); log-likelihood ℓ(θ) = Σ ln f(xᵢ|θ); MLE solves dℓ/dθ = 0
Fisher information I(θ) = −E[d²ln f(X|θ)/dθ²]; Iₙ(θ) = n I(θ)
Cramér–Rao lower bound: Var(θ̂) ≥ 1 / Iₙ(θ) for unbiased θ̂
CI for μ (σ known): x̄ ± z_{α/2} σ/√n [z = 1.645 (90%), 1.96 (95%), 2.576 (99%)]
CI for μ (σ unknown, normal): x̄ ± t_{α/2, n−1} s/√n
CI for p (large n, Wald): p̂ ± z_{α/2} √(p̂(1 − p̂)/n)
CI for σ² (normal): [ (n−1)s² / χ²_{α/2, n−1} , (n−1)s² / χ²_{1−α/2, n−1} ]
CI for μ₁ − μ₂ (σ's unknown, equal, pooled): (x̄₁ − x̄₂) ± t_{α/2, n₁+n₂−2} · s_p √(1/n₁ + 1/n₂), s_p² = [(n₁−1)s₁² + (n₂−1)s₂²]/(n₁+n₂−2)
Sample size for a mean: n = (z_{α/2} σ / E)²; for a proportion: n = z²_{α/2} p(1−p)/E² (E = margin of error)
Finite population correction: SE = (σ/√n) √((N − n)/(N − 1))

Example 1 — CI for a mean, σ unknown (small sample). A Bengaluru logistics firm times 16 last-mile deliveries: x̄ = 42 min, s = 8 min. Build a 95% CI for the mean delivery time.

Example 2 — CI and sample size for a proportion. In a survey of n = 1,200 app users, 384 clicked a new banner.

Example 3 — MLE for a Bernoulli/binomial parameter, with its CRLB. n independent users, each converts with probability p; x conversions observed.

Example 4 — MLE vs method of moments for an exponential, and bias of σ̂². Service times (hours) between machine failures: 2, 3, 5, 6, 9 (n = 5), modelled Exponential(λ) with mean 1/λ.

Example 5 — CI for a normal variance (χ²). A Coimbatore unit measures the diameter of 25 shafts: s = 0.040 mm. 95% CI for σ², ν = 24, χ²₀.₀₂₅,₂₄ = 39.364, χ²₀.₉₇₅,₂₄ = 12.401.

CriterionPoint estimateInterval estimate
OutputOne numberA range with a confidence level
Uncertainty shownNo (needs SE separately)Yes, built in
Effect of larger nMore stable valueNarrower interval (∝ 1/√n)
Typical useModel parameter, KPI valueReporting, polls, decisions, SLAs
MethodNeeds full distribution?EfficiencyTypical use
Method of momentsNo (only moments)Often lowerQuick starting values
Maximum likelihoodYesAsymptotically bestGLMs, logistic, mixtures
Least squares / OLSNo (BLUE by Gauss–Markov)Best among linear unbiasedRegression
BootstrapNoDepends on statisticMedian, AUC, Gini intervals
IntervalDistribution usedDegrees of freedom
μ, σ known or n largeZ (normal)—
μ, σ unknown, normaltn − 1
σ² of a normalχ²n − 1
σ₁²/σ₂²Fn₁−1, n₂−1
p (large n)Z on p̂—
import numpy as np
from scipy import stats

x = np.array([2, 3, 5, 6, 9], dtype=float)
n = x.size
mean, s = x.mean(), x.std(ddof=1)          # ddof=1 -> unbiased s^2
se = s / np.sqrt(n)
t_crit = stats.t.ppf(0.975, df=n - 1)
print(mean, s**2, (mean - t_crit*se, mean + t_crit*se))

# bootstrap CI for the median - no closed-form SE
rng = np.random.default_rng(0)
meds = [np.median(rng.choice(x, n, replace=True)) for _ in range(10000)]
print(np.percentile(meds, [2.5, 97.5]))

Where it is used

Interview questions

Common mistakes

Related topics

Hypothesis testing · Probability distributions · Descriptive statistics · Bayesian statistics · Experiment design and A/B testing · Causal inference basics

Open in the Knowledge reader →Find jobs →