Problem
An analyst compares how a small segment spreads over categories (days of the week, countries, product sections) with the whole population. With few events in the segment, the observed shares are noisy, so a spike in one category may be chance. Plain shrinkage pulls toward the uniform distribution, which is a poor target when the categories are naturally uneven. The post shrinks toward a stable reference distribution instead.
Example from the article: Stack Exchange posts created per weekday in 2022. All posts give a similar but less noisy weekday profile, while posts tagged "regularization" are few (169 for the year), so Monday looks special (37 posts) without evidence.
Solution in brief
Fit a LASSO with Poisson likelihood to the segment's observed shares, with the log of the reference shares as an offset. The penalty pulls the fitted shares toward the reference. Choose the penalty so that the largest gap between fitted and observed shares equals a tolerance you set.
Questions this case answers
- How to stabilize noisy category proportions of a small sample by shrinking them toward a more stable reference distribution with a bounded maximum deviation
- How to get stable category shares for a small segment when its raw shares are noisy?
- How to shrink segment shares toward a reference distribution instead of toward uniform?
- How to control how far the smoothed shares may drift from the observed ones?
Tools and methods
- LASSO with Poisson likelihood — shrinks the segment's shares toward the reference distribution.
- Offset — the log of the reference shares, which sets the shrinkage target.
- glmnet (R) — fits the penalized Poisson model; the post's code uses it.
Google or a one-time email code. No password.