Skip to content
Marketing Measurement Science

Heckman Selection Correction

Estimate a spending equation when linked spending is observed for only part of the customer population.

Why linked customers differ

Every customer has monthly spending during the measurement window, but spending is recorded only for customers who link their receipts. In this example, 1,206 of 2,000 customers link.

Customers earn reward points in proportion to what they spend, so customers who spend more have more reason to link. Longer-tenured customers spend more on average, but even among customers with the same tenure, those who spent more than usual are more likely to link. As a result, linked customers spend more on average than unlinked customers with the same tenure.

A regression fitted only to linked customers inherits this difference. In this example, it overstates spending at every tenure, and most at short tenures, where fewer customers link and the ones who do are furthest above average. It therefore also understates how much spending rises with tenure. Averaged over all 2,000 customers’ tenures, its predictions come to $113.36 a month. The true spending equation gives $103.70.

Linking that depends only on tenure would not cause this. Linked and unlinked customers with the same tenure would then spend the same on average, so a regression on linked customers would still estimate the population relationship, as long as it has the right form. In this example spending rises in a straight line with tenure, so a straight-line regression has the right form. The bias comes from linking that depends on the part of spending tenure doesn’t explain.

Heckman’s correction models who links alongside spending and uses that model to adjust the spending regression. The worked example below follows the two-step correction from the selection equation to the corrected spending regression and explains what each part assumes. The result describes spending for all customers. It does not measure whether linking receipts changes spending, which would need a treatment comparison.

Heckman two-step process

STEP 1
Probit on all customers
→
EXTRACT
Mills Ratio (λ)
→
STEP 2
Observed spending on X and λ
→
RESULT
Corrected spending equation

Step 1. Selection equation

For each of the 2,000 simulated customers, we know their tenure in months, whether they received a reminder, and whether they linked their receipts. Set the reminder indicator to 1 for customers who received it and 0 otherwise. Set S = 1 when the customer linked and S = 0 otherwise. Spending is observed for the 1,206 customers who linked, or 60.3% of the sample.

Fit a probit on all customers. The coefficients γ0, γ1, and γ2 are the intercept, tenure coefficient, and reminder coefficient in the linking model. The linear index Zγ adds the intercept to the tenure and reminder terms. The standard normal cumulative distribution Φ converts that index to a linking probability.

P(S = 1 | tenure, reminder) = Φ(γ0 + γ1 × tenure + γ2 × reminder)

The reminder was randomly assigned with a 50% probability and sent after the spending window closed. It changes whether customers link existing receipts, and spending for the window is already fixed. This is the exclusion restriction. If the reminder also changed spending, the correction would mix that change with selection.

With the reminder in the probit, the inverse Mills ratio can vary between customers with the same tenure. With tenure alone, the method relies on the curvature of the ratio to estimate separate coefficients for tenure and the ratio. The result section shows how much precision that costs. If some customer profiles have very little chance of linking, their spending predictions rely more heavily on extrapolation.

Extract. Inverse Mills ratio

For each linked customer, calculate the inverse Mills ratio λ from the fitted linking index Zγ̂. The hat marks an estimate, and φ is the standard normal density.

λ̂ = φ(Zγ̂) / Φ(Zγ̂)

This calculation uses the coefficients from Step 1. If the unexplained parts of linking and spending are jointly normal given the predictors, the average spending error among linked customers with index Zγ is ρσλ. Here ρ is the correlation between the two errors and σ is the standard deviation of the spending error. The simulation draws the errors this way, with ρ = 0.60 and σ = $30. In real data, joint normality is an assumption. If it fails, the ratio generally gives the wrong correction for the average spending error.

The linked customer with a 17.77% estimated linking probability has a ratio of 1.465. At 93.97%, the ratio falls to 0.127. With a positive error correlation, higher linking probabilities mean less upward bias in the average spending of customers who link.

Step 2. Outcome equation

Regress spending on tenure and the fitted ratio using the linked customers. In the diagram, X contains the intercept and tenure. In this equation, β0 is the intercept, β1 is the change in average spending per month of tenure, and βλ is the coefficient on λ̂. That last coefficient estimates ρσ, which equals $18 in the simulation.

spending = β0 + β1 × tenure + βλ × λ̂ + error

Ordinary least squares (OLS) assumes equal error variance across linked customers for its usual standard errors. Here the variance changes with the ratio. The usual standard errors also treat the ratio as fixed, even though its estimated inputs carry sampling error from Step 1. The two-step standard errors account for both. Here they are larger for all three coefficients. The standard error for the ratio coefficient rises from $3.027 to $3.143.

Under the model’s assumptions, testing βλ = 0 tests whether linking depends on the unexplained part of spending. Failure to reject can reflect low precision, so selection bias can still be present.

Result. Corrected spending equation

OLS on linked customers estimates a tenure slope of $0.78 per month. The Heckman fit with the reminder puts it at $1.01, close to the true $1.00. The average predicted spending in the table uses each row’s intercept and tenure slope at all 2,000 customers’ tenure values. It is $113.36 for OLS and $103.29 for the corrected equation, compared with $103.70 from the true spending equation. The customers’ simulated spending averages $103.16. The gap is the average of their random spending errors.

The corrected line uses the estimated intercept and tenure slope from Step 2, β̂0 + β̂1 × tenure. The dashed curve describes expected spending among linked customers. It adds the fitted ratio coefficient times the average ratio for linked customers at each tenure. To compute that average, weight each reminder group by its assignment probability times its fitted linking probability at that tenure.

Inspect plotted spending values
Inspect individual customer points

The OLS line approximates the dashed curve, with a largest gap of $1.01 across the plotted tenure values. The light grey points show the unlinked customers’ spending, which is visible only in the simulation. Interpret spending here as net of refunds, so it can be negative.

Without the reminder, the fitted ratio is nearly a straight-line function of tenure among linked customers. Their correlation is −0.997 without the reminder and −0.574 with it. The second step can barely separate the two terms. Without the reminder, the intercept is $84.51, the tenure slope is $0.939 per month, and the ratio coefficient is $10.21. The intercept’s standard error rises from $3.33 to $49.43 and the slope’s rises from $0.073 to $0.753.

The spending equation assumes a straight-line relationship with tenure. If that relationship is curved, a straight line can miss the population average at some tenures even after correcting for selection. The corrected equation describes average monthly spending at each tenure across all customers, including those who never linked their receipts.

Compare selection models with weighting for missing outcomes when baseline covariates and treatment can account for who is observed.