estimate_conditional_local_effects
iv.estimate_conditional_local_effects(
ds: pl.DataFrame,
outcome: ColumnName,
treatment: ColumnName,
instrument: ColumnName,
qs: ArrayLike = MEDIAN,
*,
covariates: FormulaRhs,
weight_formula: FormulaRhs | None = None,
instrument_probability_formula: FormulaRhs | None = None,
weight_adjustment: WeightAdjustment = WeightAdjustment.PROJECTION,
weights: ColumnName | None = None,
trim: float = _DEFAULT_TRIM,
bootstrap_config: BootstrapConfig | int = 100,
)Estimate conditional quantile treatment effects for compliers as in Abadie et al. (2002).
The model postulates that \(Q_{\theta}(Y \mid X, D, D_{1} > D_{0}) = \alpha_{\theta} D + X' \beta_{\theta}\). \(\theta\) indexes the quantile of \(Y\). \(D\) is binary, one-dimensional and endogenous, which is why it needs to be instrumented.
\(\alpha\) can, in principle, be obtained from the following quantile regression problem: \[ (\alpha_{\theta}, \beta_{\theta}) = \arg\min_{\alpha, \beta} E\big[\kappa \, \rho_{\theta}(Y - \alpha D - X' \beta)\big], \]
where \(\kappa\) is the signed Abadie’s kappa weight (\(\kappa = 1 - \frac{D\,(1 - Z)}{1 - \pi_0(X)} - \frac{(1 - D)\,Z}{\pi_0(X)}\) with \(\pi_0(X) = P(Z = 1 \mid X)\)). This problem is computationally challenging since the weights can be negative. Thus, the weights are replaced with another set of weights, where \(U = (Y, D, X)\) and \(\nu_0(U) = E[Z \mid U]\):
\[ \tilde{\kappa}(U) = E[\kappa \mid U] = 1 - \frac{D\,(1 - \nu_0(U))}{1 - \pi_0(X)} - \frac{(1 - D)\,\nu_0(U)}{\pi_0(X)}, \]
which can be shown to be nonnegative across the board. The weight_formula gives the design of the first step and weight_adjustment the way it is used: PLUGIN approximates \(\nu_0(U)\) and plugs it into the identity above, PROJECTION projects \(\kappa\) on the design directly.
Standard errors are found via a case bootstrap.
The estimand is the coefficient on the treatment in a quantile regression of the outcome on the treatment and the covariates, for compliers. Notice that the conditional (on \(X\)) effect (on the compliers) generally does not coincide with the unconditional effect (on the compliers). This is because here we identify \(Q_{\theta}(Y \mid D=1, X=x) - Q_{\theta}(Y \mid D=0, X=x) = \alpha_{\theta}\) (for the compliers), but if we integrate out \(X\) on the left hand side, the resulting functional is not comprised of the marginal distributions of \(Y\) given the treatment status for the compliers, since quantiles are not linear operators.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ds | polars.DataFrame |
Input data. | required |
| outcome | ColumnName |
Name of the outcome column. | required |
| treatment | ColumnName |
Name of the binary treatment column (1 treated, 0 not). |
required |
| instrument | ColumnName |
Name of the binary instrument column (1 encouraged, 0 not). |
required |
| qs | array_like |
Quantiles in (0, 1) at which to estimate the effect. |
0.5 |
| covariates | FormulaRhs |
Right-hand side of the covariates the effect is conditional on; these are the controls of the quantile regression. | required |
| weight_formula | FormulaRhs |
Full right-hand side of the first-stage regression that forms the complier weights. Use poly/I to build an outcome series, e.g. "poly(earnings, 5) + covariates". When omitted, outcome + covariates is used. |
None |
| instrument_probability_formula | FormulaRhs |
Right-hand side of the logit model for P(Z = 1 \| X). When omitted the instrument probability is taken to be constant. |
None |
| weight_adjustment | WeightAdjustment |
How the nonnegative complier weights are formed. | WeightAdjustment.PROJECTION |
| weights | ColumnName |
Name of a column with sampling weights. | None |
| trim | float |
Drop observations whose estimated instrument propensity lies outside [trim, 1 - trim]. 0 keeps every observation. |
0.001 |
| bootstrap_config | BootstrapConfig or int |
Bootstrap settings, or the number of replications. | 100 |
Returns
| Name | Type | Description |
|---|---|---|
ConditionalLocalQteResult |
Conditional complier quantile effects and the LATE with bootstrap standard errors. |
See Also
qte.iv.estimate_unconditional_local_effects WeightAdjustment
References
Abadie, A., Angrist, J., & Imbens, G. (2002). Instrumental Variables Estimates of the Effect of Subsidized Training on the Quantiles of Trainee Earnings. Econometrica, 70(1), 91–117.