Tutorials › Propensity Score Matching and Instrumental Variables › Worked Count-Outcome Analysis With Residual Inclusion

Binary and Nonlinear Outcome IV Methods · Tutorial 576 of 699

Worked Count-Outcome Analysis With Residual Inclusion

Learn to construct a generalized residual for a binary exposure, include it in a Poisson outcome model, and use the fitted model to calculate and interpret predicted count contrasts.

Advanced 11 min read

What You'll Learn

  • Derive the generalized residual for a binary exposure from a probit first stage
  • Check the assumptions needed to interpret residual inclusion causally
  • Fit and interpret a Poisson log-mean model that includes the residual
  • Calculate counterfactual expected counts and an average count contrast
  • Diagnose weak instruments, poor fit, and control-function specification problems
  • Compare residual inclusion with substitution and joint-model approaches

Why Residual Inclusion for a Count Outcome?

A count outcome such as the number of hospital visits can have a strongly right-skewed distribution and a mean that changes multiplicatively with exposure. If exposure is endogenous, a standard Poisson regression of the count on exposure and covariates does not, by itself, remove the resulting bias. Two-stage residual inclusion (2SRI) is one control-function approach: model the binary exposure using an instrument and covariates, construct a generalized residual, and include that residual in the count-outcome model.

This is a worked analysis rather than a universal recipe. A valid instrument and a suitable first-stage model are necessary, but not sufficient: the outcome model must also represent how the control function captures the dependence between exposure and the outcome disturbance. The resulting causal interpretation depends on these assumptions, not merely on including a residual as an extra predictor.

Definition: Let \(Y\) be a count outcome, \(D\) a binary exposure, \(Z\) an instrumental variable, and \(X\) a vector of observed covariates. In Poisson 2SRI, first estimate a model for \(D\) given \(Z\) and \(X\), calculate a generalized residual \(r\) for each observation, and fit a count-outcome model that includes \(D\), \(X\), and \(r\). The residual is a control-function term; it is not a second-stage fitted exposure.

Assumptions and the Generalized Residual

For the examples, use a probit first stage. Write its latent-index representation as \(D=1\) when \(\eta+u>0\), and \(D=0\) otherwise, where \(\eta=\gamma_0+\gamma_Z Z+\gamma_X X\) in a simple model. The model assumes \(u\mid Z,X\sim N(0,1)\); the scale is set to one in a probit model. The instrument must predict exposure conditional on \(X\), and, for causal interpretation, must be independent of the relevant potential outcomes conditional on \(X\) and affect the outcome only through exposure. These are substantive assumptions, not facts established by a significant first-stage coefficient.

The generalized residual is the conditional expectation of the latent first-stage error given the observed exposure and first-stage predictors. Let \(\phi\) and \(\Phi\) denote the standard normal density and distribution functions. If \(\eta\) is the fitted index, then:

$$ r = \begin{cases} \displaystyle \frac{\phi(\eta)}{\Phi(\eta)}, & D=1,\\[6pt] \displaystyle -\frac{\phi(\eta)}{1-\Phi(\eta)}, & D=0. \end{cases} $$

To see why, an exposed observation implies \(u>-\eta\). The mean of a standard normal variable truncated below at \(-\eta\) is \(\phi(\eta)/\Phi(\eta)\). An unexposed observation implies \(u\leq-\eta\); the corresponding truncated mean is \(-\phi(\eta)/[1-\Phi(\eta)]\). Thus, \(r=E(u\mid D,Z,X)\) under the probit model. It is not generally equal to \(D-\widehat P(D=1\mid Z,X)\). That difference is a residual on the probability scale, not this probit generalized residual.

The second stage specifies a conditional count mean, for example:

$$ E(Y\mid D,X,r)=\mu(D,X,r) =\exp\left(\beta_0+\beta_D D+\beta_X X+\beta_r r\right). $$

Here the Poisson log link ensures positive fitted means. For causal interpretation, the control-function specification must adequately capture the dependence of exposure on unobserved outcome determinants, and the model must give the relevant conditional mean under each exposure level. In particular, correlation between exposure and an unobserved factor alone does not prove that including this one residual with a linear coefficient is sufficient. The specified conditional mean and the instrument assumptions need substantive justification.

Worked Example: Constructing Probit Generalized Residuals

Consider hypothetical data on four people. Suppose the fitted first-stage model is \(\eta=-0.4+0.7Z+0.3X\), where \(Z\) and \(X\) are binary. The first-stage probability is \(\widehat p=\Phi(\eta)\). Use \(\phi(0.4)=0.3683\), \(\phi(0.1)=0.3970\), \(\phi(0.3)=0.3814\), and \(\phi(0.6)=0.3332\).

Person\(Z\)\(X\)\(D\)\(\eta\)
A001-0.4
B1000.3
C010-0.1
D1110.6

For A, \(\Phi(-0.4)\approx0.3446\), so its exposure probability is about 0.3446. Since \(D=1\), its residual is \(r=0.3683/0.3446\approx1.069\). For B, \(1-\Phi(0.3)\approx0.3821\) and \(D=0\), giving \(r=-0.3814/0.3821\approx-0.998\). For C, \(1-\Phi(-0.1)\approx0.5398\), so \(r=-0.3970/0.5398\approx-0.735\). For D, \(\Phi(0.6)\approx0.7257\), giving \(r=0.3332/0.7257\approx0.459\).

These calculations follow the observed \(D\) for each person; they do not assign the person the fitted probability in place of the exposure. The example also illustrates the role of the instrument in the first stage: with \(X\) fixed, changing \(Z\) changes \(\eta\), and hence the modeled probability of exposure and the generalized residual.

Fitting and Interpreting the Poisson Second Stage

Estimate the second-stage conditional mean using the observed count \(Y\), observed exposure \(D\), covariates \(X\), and first-stage residual \(r\). In a Poisson likelihood fit, the model treats the conditional distribution as Poisson with the stated mean. For estimating the mean parameters, the key requirement is a correctly specified conditional mean; if the Poisson variance assumption is doubtful, use an appropriate robust variance estimate. Such a variance correction does not repair a wrong mean model, an invalid instrument, or a misspecified control function.

Worked Example: Interpreting a Fitted Count Model

Suppose a hypothetical study models the number of clinic visits per person during a fixed one-year follow-up. The fitted second-stage model is:

$$ \widehat\mu =\exp(0.20+0.45D+0.10X+0.30r). $$

The exposure coefficient is on the log expected-count scale. At fixed \(X\) and \(r\), changing \(D\) from 0 to 1 multiplies the fitted conditional mean by \(\exp(0.45)\approx1.568\). Thus, under this model and its causal assumptions, the conditional expected visit count is estimated to be 1.568 times as large for exposure than no exposure at the same covariate and control-function values. This is a conditional count ratio, not a difference of 0.45 visits and not automatically a population-average causal effect.

The residual coefficient is also on the log-mean scale. A one-unit increase in \(r\), holding \(D\) and \(X\) fixed, multiplies the fitted mean by \(\exp(0.30)\approx1.350\). Its role is adjustment for modeled selection into exposure; it should not ordinarily be presented as the causal effect of changing the residual. The intercept gives the fitted mean for \(D=X=r=0\), which is \(\exp(0.20)\approx1.221\) visits over the one-year period.

Predicted Count Contrasts

A coefficient on the log scale is not itself a count difference. To obtain a count-scale contrast, calculate predicted means under exposure and no exposure, then subtract them. A standardized contrast can average those predictions over a chosen set of covariate and control-function values. Holding \(r\) fixed while changing \(D\) defines a model-based contrast conditional on the observed residual; because \(r=E(u\mid D,Z,X)\) depends on observed \(D\), this is not automatically a person-level counterfactual or population causal contrast. A causal interpretation requires additional structural control-function assumptions that justify this intervention and the chosen standardization.

Worked Example: Standardizing Predicted Counts

Use the fitted model from the previous example and the four hypothetical observations from the first-stage example. For each person, calculate both predicted means using that person's \(X\) and \(r\), holding \(r\) fixed across the two exposure predictions.

For A, \(X=0\) and \(r\approx1.069\). The no-exposure mean is \(\exp(0.20+0.30(1.069))=\exp(0.5207)\approx1.683\) visits; the exposure mean is \(\exp(0.9707)\approx2.639\). For B, \(X=0,r\approx-0.998\): the predictions are \(\exp(-0.0994)\approx0.905\) and \(\exp(0.3506)\approx1.420\). For C, \(X=1,r\approx-0.735\): they are \(\exp(0.0795)\approx1.083\) and \(\exp(0.5295)\approx1.698\). For D, \(X=1,r\approx0.459\): they are \(\exp(0.4377)\approx1.549\) and \(\exp(0.8877)\approx2.429\).

The average no-exposure prediction is \((1.683+0.905+1.083+1.549)/4\approx1.305\) visits per person over the year. The average exposure prediction is \((2.639+1.420+1.698+2.429)/4\approx2.047\). Their difference is approximately \(2.047-1.305=0.742\) additional visits per person over the year. The average ratio is approximately \(2.047/1.305=1.569\), consistent with the common exposure coefficient and the model's constant multiplicative effect. These are model-based estimates; with only four illustrative observations, they are not a precise estimate for a target population.

Diagnostics, Alternatives, and Limitations

A sound analysis checks each stage rather than relying on the final coefficient alone. In the first stage, inspect whether the instrument contributes meaningful predictive information conditional on \(X\), whether fitted probabilities are extreme, and whether the probit form is plausible. Very weak prediction leaves little information to separate exposure effects from selection. Probabilities near zero or one can also produce large generalized residuals, making estimates sensitive to a few observations. Examine the outcome mean specification, influential observations, and whether predicted means and residual patterns suggest systematic lack of fit. If counts are more variable than the Poisson model allows, robust standard errors may address variance misspecification, but not misspecification of the conditional mean.

The residual is estimated, not observed. Uncertainty calculations that act as though it were fixed can understate uncertainty. A practical option is a bootstrap that repeats both the first and second stages in each resample; if observations are clustered, resample at the appropriate independent-cluster level. A joint estimating-equation or other suitable variance procedure can also account for first-stage estimation. The analysis should report the first-stage model, residual definition, second-stage specification, variance procedure, and the target population or standardization distribution.

Residual inclusion is particularly useful because it carries first-stage information into a nonlinear outcome model. By contrast, two-stage predictor substitution puts the fitted exposure probability in place of \(D\) in the second stage. In nonlinear models this generally does not reproduce the residual-inclusion adjustment and does not generally identify the same effect. A full-information joint model can represent dependence between exposure and outcome errors directly, but usually requires stronger distributional and joint-model assumptions. A linear IV model targets a different mean structure and can give inadequate or implausible predictions for counts. No approach is assumption-free.

A practical sequence is:

1
Specify the first stage.
Choose and justify a binary-response model for exposure using the instrument and covariates; check relevance and fitted probabilities.
2
Construct the generalized residual.
For a probit model, calculate the conditional latent-error mean using the observed exposure status and fitted index.
3
Fit and assess the count mean.
Include exposure, covariates, and the residual in the Poisson log-mean model; assess mean fit and use suitable inference.
4
Report predictions on a useful scale.
Calculate fitted means under each exposure level, average over a stated target distribution, and report the count difference or ratio with uncertainty.

A common mistake is to replace the binary exposure by its fitted probability in the Poisson outcome model and call this “two-stage IV.” That is predictor substitution, not the residual-inclusion procedure described here; nonlinear outcome models do not generally preserve the desired adjustment under this substitution. Another mistake is to interpret \(\exp(\widehat\beta_D)\) as an unconditional causal count ratio without qualification. It is a conditional model ratio at fixed \(X\) and \(r\); a population-average contrast requires predictions averaged over a stated population and credible causal and model assumptions.

Key takeaway: Poisson 2SRI combines a correctly specified first-stage generalized residual with a defensible nonlinear outcome conditional mean. The fitted count contrasts are meaningful only to the extent that the instrument, control-function, outcome-model, and target-population assumptions are credible.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In a probit first stage, what does the generalized residual represent, and why is it not simply \(D-\widehat p\)?
  2. If \(\widehat\beta_D=0.20\) in a log-mean model, what is the conditional count ratio for exposure versus no exposure, holding the other model terms fixed?
  3. Why should first-stage estimation be accounted for when calculating uncertainty in a 2SRI analysis?
  4. For a model \(\widehat\mu=\exp(0.1+0.3D)\), calculate the predicted mean for each exposure level and their count difference when all other terms are zero.

Solutions. (1) It is \(E(u\mid D,Z,X)\), the conditional mean of the probit latent error given observed exposure and predictors. \(D-\widehat p\) is a probability-scale residual and is not the conditional latent-error mean. (2) \(\exp(0.20)\approx1.221\), so the conditional expected count is about 1.221 times as large. (3) The residual is generated from estimated first-stage parameters; treating it as fixed can omit uncertainty from that estimation. (4) For \(D=0\), \(\widehat\mu=\exp(0.1)\approx1.105\); for \(D=1\), \(\widehat\mu=\exp(0.4)\approx1.492\). The difference is approximately \(1.492-1.105=0.387\) expected counts per unit of the outcome's observation period.

Clinical Biostats