Simpson's Paradox, Segregation Metrics, and Fixing Ad Regression
Statistics & ExperimentsModel answerLast updated
Explain a classic statistical trap, design spatial metrics for species data, diagnose a causal inference problem, and reduce survey error — all in plain language.
Setting
You are a data scientist supporting a product analytics team. Your work spans experiment design, metric creation, and communicating statistics to non-technical stakeholders.
Answer all four parts below. Where useful, use concrete numbers or formulas, but make sure your reasoning would be clear to a non-technical product manager.
Part 1 — A Counterintuitive Aggregation Trap
Describe the statistical phenomenon where a trend holds within every subgroup but flips or vanishes when those subgroups are pooled. Walk a PM through a concrete numeric example (a simple table is fine). What is the underlying cause, and what is the practical fix?
Part 2 — Measuring Species Separation in a Forest
A wildlife team has mapped the locations of three bird species across a forest. Propose two or more metrics that quantify how spatially separated the species are from one another. Define each metric, state its range and interpretation, and flag any methodological pitfalls.
Part 3 — What Is Wrong with This Regression?
An analyst fits a simple linear regression of weekly product sales on YouTube ad impressions. List the statistical and causal problems with this approach, then describe how you would redesign the study to get a defensible estimate of ad effectiveness.
Part 4 — Shrinking Survey Uncertainty
Name several ways to reduce a survey's margin of error. Then focus on the constrained case: sample size and confidence level are both fixed. What other levers exist, and why might bootstrap resampling be relevant here?
Hints
Hint 1
For Part 1, think about what happens when two groups have very different mixes of 'easy' versus 'hard' cases — the lurking variable is the key. Build a 2×2 table where each subgroup goes one way but the totals go the other way.
Hint 2
For Part 3, think beyond omitted variables. Consider the direction of causality (do sales drive ad spend, or vice versa?), time-series structure, and the difference between a statistically significant coefficient and a business-meaningful effect size.
Hint 3
For Part 4, the margin-of-error formula has several multiplicative terms besides n and z. Stratification, design effect, auxiliary information, and measurement quality are all handles you can pull when the obvious two are locked.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Part 1 — The Aggregation Trap (Simpson's Paradox)
What it is. A trend holds in every subgroup but reverses when the subgroups are merged. The cause is a lurking variable that affects both group membership and the outcome, making the pooled comparison measure the mix of groups rather than the effect of interest.
Numeric example for a PM. Two checkout designs, old and new, tested across desktop and mobile:
| Segment | New design | Old design |
|---|---|---|
| Desktop | 90 / 300 = 30% | 250 / 1000 = 25% |
| Mobile | 100 / 1000 = 10% | 24 / 300 = 8% |
| Combined | 190 / 1300 = 14.6% | 274 / 1300 = 21.1% |
The new design beats the old one on desktop and on mobile, yet loses in the aggregate. Why? The new design got most of its traffic from mobile (low converters), while the old design got most of its traffic from desktop (high converters). The aggregate number is dominated by device mix, not design quality.
Plain-language fix: "Before comparing totals, verify that both groups faced the same mix of users. If they did not, compare within like-for-like segments, or run a randomized experiment so the mix is equal by construction."
Important nuance. Stratifying is not always correct. You should condition on a variable only when it is a confounder — something that causally affects both treatment assignment and the outcome. Conditioning on a mediator (something the treatment itself changes) or a collider introduces new bias. The right stratification choice follows from the causal structure, not from the arithmetic.
Part 2 — Spatial Segregation Metrics for Three Bird Species
Divide the forest into plots i = 1…N. Let n_ik = count of species k in plot i, T_i = total birds in plot i, N_k = total birds of species k, T = all birds, P_k = N_k / T.
Pairwise dissimilarity index (Duncan's D).
D_jk = ½ Σ_i | n_ij/N_j − n_ik/N_k |
Range 0–1. Interpreted as the fraction of species j that would need to relocate for j and k to share the same spatial distribution. Three species yield three pairwise scores, each easy to explain.
Multigroup entropy index (Theil's H).
Forest-wide diversity: E = −Σ_k P_k ln P_k. Plot-level diversity: E_i similarly.
H = 1 − Σ_i (T_i · E_i) / (T · E)
H = 0 means every plot reflects the forest-wide species mix; H = 1 means every plot contains only one species. This produces a single summary number across all three species simultaneously.
Isolation index.
I_k = Σ_i (n_ik / N_k)(n_ik / T_i)
This is the probability that a randomly chosen neighbor of a species-k bird is also species k. If I_k is substantially above P_k, the species clusters with its own kind.
Nearest-neighbor approach (plot-free). For each individual bird, check whether its nearest neighbor belongs to the same species. Compare the observed same-species rate to what random spatial labeling would produce, using a permutation test. This avoids the modifiable areal unit problem: metrics based on fixed plots change with plot size, so reporting results at multiple spatial scales is good practice.
Pitfalls to flag. All four measures above normalize for unequal species abundances, which matters. Always attach uncertainty via plot resampling. Distinguish behavioral avoidance from habitat-driven clustering by computing metrics within habitat strata (e.g., forest type or elevation).
Part 3 — Problems with the Ad Regression, and How to Fix It
Problems with sales ~ impressions:
- Omitted-variable bias. Seasonality, promotions, pricing, competing channels (TV, search), and product launches all shift both ad spend and sales simultaneously. Leaving them out pushes their effects onto the impressions coefficient.
- Reverse causality. Ad budgets are often raised ahead of expected high-sales periods (holidays, launches). Ad platforms also target users already likely to buy. Both inflate the observed correlation without representing a causal effect.
- Time-series structure. Week-over-week autocorrelation deflates standard errors, and shared trends produce spurious correlation even when there is no true effect.
- Wrong functional form. Ad effects decay across weeks (adstock) and saturate at high spend (diminishing returns). A straight line misrepresents the marginal effect at any particular spend level.
- Other concerns: multicollinearity with other channels, heteroskedasticity, measurement error in impressions (bot traffic, non-viewable impressions), and the risk of extrapolating beyond observed spend levels.
- Significance ≠ magnitude. A significant slope tells you nothing about business-relevant lift or ROI without an effect-size estimate and confidence interval.
Redesign options:
Gold standard — randomized experiment. Run a geo-level holdout: assign matched geographic regions to different spend levels, measure incremental sales, and report lift with a confidence interval and incremental return on ad spend (iROAS). Alternatively, run a user-level conversion-lift study using ghost ads or PSA controls. Pre-register the primary metric, run a power analysis for the minimum detectable effect, and use cluster-robust standard errors.
When experimentation is not feasible. Use difference-in-differences or synthetic control around natural spend changes. Instrumental variables (e.g., exogenous auction-price shocks) can isolate causal variation. A media mix model with adstock and saturation terms, full channel controls, and calibration against any available lift tests is the standard industry fallback.
Part 4 — Reducing Survey Margin of Error
The margin of error for a proportion is approximately:
MOE ≈ z · √(p(1−p)/n) · √deff · √((N−n)/(N−1))
Each factor is a lever:
- Increase n — MOE shrinks with 1/√n, so quadrupling sample size halves the error.
- Lower confidence level — dropping from 95% to 90% reduces z from 1.96 to 1.645.
- Reduce the design effect (deff) — avoid heavy clustering and extreme post-survey weights.
- Apply the finite-population correction — relevant when sampling a large share of a small, well-defined population.
When n and confidence level are fixed:
- Stratified sampling. Partition respondents into homogeneous strata and allocate the fixed sample across them (proportional or Neyman allocation). Between-stratum variance is removed entirely from the estimator, often the single biggest win.
- Auxiliary information. Ratio estimators, regression estimators, and post-stratification on known population totals (age, region, past behavior) can sharply reduce variance without adding respondents. The CUPED technique in A/B testing applies the same logic using pre-experiment data.
- Better measurement. Clearer question wording, continuous response scales instead of binary yes/no where appropriate, and reduced nonresponse all lower the effective noise in the outcome variable.
Why bootstrap resampling helps. When the survey design is complex (stratification, clustering, calibration weights), the closed-form MOE formula may be unreliable. Bootstrap resampling — repeatedly drawing pseudo-samples that mirror the original survey design — gives a direct empirical estimate of the sampling distribution. It also provides valid confidence intervals for non-standard statistics (medians, ratios, domain estimates) where no clean analytic formula exists. The key requirement is that the resampling scheme must replicate the original sampling mechanism, including strata and cluster structure, to produce honest uncertainty estimates.