moderndid.reg_did_panel#

moderndid.reg_did_panel(y1, y0, d, covariates=None, i_weights=None, boot=False, boot_type='weighted', nboot=999, influence_func=False)[source]#

Compute the outcome regression DiD estimator for the ATT with panel data.

Implements the outcome regression DiD estimator for the ATT with panel data, as defined in equation (2.2) of [2]. The estimator is given by

\[\widehat{\tau}^{reg} = \bar{Y}_{1,1} - \left[\bar{Y}_{1,0} + n_{treat}^{-1} \sum_{i|D_i=1} (\widehat{\mu}_{0,1}(X_i) - \widehat{\mu}_{0,0}(X_i))\right].\]

The estimator follows the same spirit of the nonparametric estimators proposed by [1], though here the outcome regression models are assumed to be linear in covariates (parametric). The nuisance parameters (outcome regression coefficients) are estimated via ordinary least squares.

Parameters:
y1numpy.ndarray

A 1D array of outcomes from the post-treatment period.

y0numpy.ndarray

A 1D array of outcomes from the pre-treatment period.

dnumpy.ndarray

A 1D array of group indicators (1 if treated in post-treatment, 0 otherwise).

covariatesnumpy.ndarray, optional

A 2D array of covariates to be used in the regression estimation. Please include a column of constants if you want to include an intercept in the regression model. If None, this leads to an unconditional DiD estimator.

i_weightsnumpy.ndarray, optional

A 1D array of weights. If None, then every observation has equal weight. Weights are normalized to have mean 1.

bootbool, default=False

Whether to compute bootstrap standard errors.

boot_type{“weighted”, “multiplier”}, default=”weighted”

Type of bootstrap to be performed (not relevant if boot = False).

nbootint, default=999

Number of bootstrap repetitions (not relevant if boot = False).

influence_funcbool, default=False

Whether to return the influence function.

Returns:
RegDIDPanelResult

A NamedTuple containing:

  • attfloat

    The outcome regression DiD point estimate.

  • sefloat

    The outcome regression DiD standard error.

  • ucifloat

    Upper bound of a 95% confidence interval.

  • lcifloat

    Lower bound of a 95% confidence interval.

  • bootsndarray or None

    All bootstrap draws of the ATT, if bootstrap was used.

  • att_inf_funcndarray or None

    Estimate of the influence function if influence_func=True.

  • argsdict

    Arguments used in the estimation.

See also

reg_did_rc

Outcome regression DiD for repeated cross-sections.

drdid_imp_panel

Improved doubly robust DiD for panel data.

ipw_did_panel

Inverse propensity weighted DiD for panel data.

References

[1]

Heckman, J., Ichimura, H., and Todd, P. (1997), “Matching as an Econometric Evaluation Estimator: Evidence from Evaluating a Job Training Programme”, Review of Economic Studies, vol. 64(4), p. 605–654. https://doi.org/10.2307/2971733

[2]

Sant’Anna, P. H. C. and Zhao, J. (2020), “Doubly Robust Difference-in-Differences Estimators.” Journal of Econometrics, Vol. 219 (1), pp. 101-122. https://doi.org/10.1016/j.jeconom.2020.06.003