moderndid.compute_conditional_cs_sdm#

moderndid.compute_conditional_cs_sdm(betahat, sigma, num_pre_periods, num_post_periods, l_vec=None, m_bar=0, alpha=0.05, monotonicity_direction='increasing', 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^{SDI}(M)\).

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

The combined smoothness and monotonicity restriction, denoted \(\Delta^{SDI}(M)\) in [2], is defined as the intersection of \(\Delta^{SD}(M)\) and a monotonicity restriction \(\Delta^I\)

\[\Delta^{SDI}(M) := \Delta^{SD}(M) \cap \Delta^{I},\]

where

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

and \(\Delta^{I} := \{\delta: \delta_t \ge \delta_{t-1}, \forall t\}\) for an increasing trend. For a decreasing trend, the restriction is \(\Delta^{SD}(M) \cap (-\Delta^{I})\).

This restriction is useful when economic theory suggests both smooth evolution of trends and monotonic behavior (e.g., secular trends expected to continue post-treatment). The intersection typically leads to smaller identified sets than using either restriction alone.

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. If None, defaults to first post-period.

m_barfloat, default=0

Smoothness parameter M for \(\Delta^{SDI}(M)\).

alphafloat, default=0.05

Significance level.

monotonicity_direction{‘increasing’, ‘decreasing’}, default=’increasing’

Direction of monotonicity restriction.

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 or float

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

Notes

\(\Delta^{SDI}(M)\) is a polyhedron formed by the intersection of smoothness and monotonicity constraints. The confidence set is constructed using either FLCIs or the moment inequality approach from Section 3 of [2].

As noted in [2], monotonicity restrictions are often motivated by economic arguments. For example, Lovenheim & Willen (2019) argue that pre-treatment trends in the “wrong direction” (opposite to treatment effects) support their findings.

Unlike \(\Delta^{SD}(M)\) alone, the optimal FLCI for \(\Delta^{SDI}(M)\) has the same worst-case bias as for \(\Delta^{SD}(M)\), meaning FLCIs do not adapt to the additional monotonicity restriction.

References

[1]

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

[2] (1,2,3)

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