moderndid.compute_conditional_cs_sd#

moderndid.compute_conditional_cs_sd(betahat, sigma, num_pre_periods, num_post_periods, l_vec=None, m_bar=0, alpha=0.05, hybrid_flag='FLCI', hybrid_kappa=None, post_period_moments_only=True, grid_points=1000, grid_lb=None, grid_ub=None, seed=None)[source]#

Compute conditional confidence set for \(\Delta^{SD}(M)\).

Computes a confidence set for \(l'\tau_{post}\) that is valid conditional on the event study coefficients being in the identified set under \(\Delta^{SD}(M)\).

The smoothness restriction \(\Delta^{SD}(M)\) formalizes the concern about confounding from secular trends that evolve smoothly over time. It bounds the discrete analog of the second derivative, as defined in Equation (8) of [3]

\[\Delta^{SD}(M) := \{\delta: |(\delta_{t+1} - \delta_t) - (\delta_t - \delta_{t-1})| \le M, \forall t\}.\]

When \(M = 0\), this requires the differential trend to be exactly linear, corresponding to the common practice of controlling for linear group-specific trends. For \(M > 0\), it allows for approximate linearity, acknowledging that linear specifications may not be exactly correct.

Parameters:
betahatnumpy.ndarray

Estimated event study coefficients.

sigmanumpy.ndarray

Covariance matrix of betahat.

num_pre_periodsint

Number of pre-treatment periods.

num_post_periodsint

Number of post-treatment periods.

l_vecnumpy.ndarray, optional

Vector defining parameter of interest \(\theta = l'\tau_{post}\). If None, defaults to first post-period.

m_barfloat, default=0

Smoothness parameter M. Bounds the second differences: \(|\delta_{t-1} - 2\delta_t + \delta_{t+1}| \leq M\).

alphafloat, default=0.05

Significance level.

hybrid_flag{‘FLCI’, ‘LF’, ‘ARP’}, default=’FLCI’

Type of hybrid test.

hybrid_kappafloat, optional

First-stage size for hybrid test. If None, defaults to alpha/10.

post_period_moments_onlybool, default=True

If True, use only post-period moments for ARP test.

grid_pointsint, default=1000

Number of grid points for confidence interval search.

grid_lbfloat, optional

Lower bound for grid search.

grid_ubfloat, optional

Upper bound for grid search.

seedint, optional

Random seed for reproducibility.

Returns:
dict

Returns dict with ‘grid’ and ‘accept’ arrays.

Notes

\(\Delta^{SD}(M)\) is convex and centrosymmetric (i.e. \(\tilde{\delta} \in \Delta\) implies \(-\tilde{\delta} \in \Delta\)), which allows for the use of Fixed Length Confidence Intervals (FLCIs) with near-optimal finite-sample properties [2]. The identified set under \(\Delta^{SD}(M)\) has constant length \(2M\) regardless of the pre-treatment coefficients.

The confidence set is constructed using either FLCIs (default) or the moment inequality approach from Section 3 of [3]. For FLCIs, the expected length is at most 28% longer than the shortest possible confidence set satisfying the coverage requirement when the true parameter is at the center of the identified set (Proposition 4.1 in [2]).

References

[1]

Andrews, I., Roth, J., & Pakes, A. (2021). Inference for linear conditional moment inequalities. Review of Economic Studies.

[2] (1,2)

Armstrong, T. B., & Kolesár, M. (2018). Optimal inference in a class of regression models. Econometrica, 86(2), 655-683.

[3] (1,2)

Rambachan, A., & Roth, J. (2023). A more credible approach to parallel trends. Review of Economic Studies, 90(5), 2555-2591.