Power Law Fitting with MLE

Generate power-law data and fit exponent α via maximum likelihood — compare to naive log-log regression

True α: 2.50 MLE α̂: Log-log α̂: N: 500
Clauset-Shalizi-Newman (2009): The MLE estimator for power-law exponent is α̂ = 1 + n[Σln(xᵢ/x_min)]⁻¹ — a single closed-form expression. This is unbiased and efficient. Naive log-log linear regression is biased because it ignores the non-uniform variance in log-binned histograms. The bias can be substantial (often 10-20%). Left panel: log-log plot with both fitted lines. Right panel: log-likelihood surface L(α) — MLE is the peak. Bootstrap gives confidence intervals by resampling. Note: power laws are often confused with log-normal or stretched exponential distributions.