Skip to content
AT Ali Taqi
All Work

Poisson Regression, Three Ways

A standalone report that fits a single Poisson GLM to library checkout counts three ways — maximum likelihood, ridge-penalized estimation, and full Bayesian inference via a hand-coded Metropolis MCMC sampler — and compares what each one says.

The hand-coded Metropolis sampler exploring the joint posterior of the intercept and age-slope coefficients. Each point is one accepted draw; the diagonal spread is their negative correlation, and the amber diamond marks the posterior mean.
Bayesian inferenceMetropolis MCMCPoisson GLMMaximum likelihoodRidge regularizationR

This report takes a deliberately simple model — a Poisson generalized linear model for count data, fit to library book-checkout counts — and works it through three different statistical philosophies to see where they agree and where they diverge. The problem originated on my mathematical-statistics final; the report is its revised, standalone treatment, with every derivation re-validated, the sampler re-tuned, and the figures rebuilt.

The frequentist pass derives the likelihood, finds the maximum-likelihood estimates, and builds confidence intervals two ways — from asymptotic theory and from a 5,000-resample bootstrap. The penalized pass adds ridge regularization to the slope and traces the full shrinkage path. The Bayesian pass specifies Gaussian priors over the coefficients and samples the posterior with a hand-written Metropolis MCMC algorithm — two chains, trace-plot and effective-sample-size diagnostics — then reads off credible intervals and posterior summaries.

Setting all three side by side is the whole point — a compact tour of how maximum likelihood, regularization, and Bayesian inference each frame the same uncertainty (and, under weak priors, how closely their answers coincide). The MCMC sampler and the Bayesian machinery here are exactly the tools that resurface in insurance and financial risk modeling.