moderndid.compute_conditional_cs_sdrmm#

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

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

Computes a confidence set for \(l'\tau_{post}\) under the restriction that delta lies in \(\Delta^{SDRMM}(\bar{M})\), which combines the second-differences-with-relative-magnitudes restriction with a monotonicity constraint.

This combined restriction is the intersection of \(\Delta^{SDRM}(\bar{M})\) and a monotonicity restriction \(\Delta^{Mon}\), as discussed in Section 2.4.4 of [1],

\[\Delta^{SDRMM}(\bar{M}) = \Delta^{SDRM}(\bar{M}) \cap \Delta^{Mon}\]

where for an increasing trend, \(\Delta^{Mon} = \Delta^{I} = \{\delta : \delta_t \geq \delta_{t-1}, \forall t\}\).

This restriction is useful when pre-treatment trends suggest smoothly evolving confounders and economic theory suggests monotonic effects over time.

Parameters:
betahatnumpy.ndarray

Estimated event study coefficients.

sigmanumpy.ndarray

Covariance matrix of \(\hat{\beta}\).

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

Relative magnitude parameter \(\bar{M}\). Second differences in post-treatment periods can be at most \(\bar{M}\) times the maximum absolute second difference in pre-treatment periods.

alphafloat, default=0.05

Significance level.

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

Type of hybrid test.

hybrid_kappafloat, optional

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

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

Direction of monotonicity restriction.

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.

Raises:
ValueError

If num_pre_periods == 1 (not enough pre-periods for second differences). If hybrid_flag is not in {‘LF’, ‘ARP’, ‘FLCI’}.

Notes

The confidence set is constructed using the moment inequality approach from Section 3 of Rambachan & Roth (2023). Since \(\Delta^{SDRMM}(\bar{M})\) is a finite union of polyhedra, we can apply Lemma 2.2 to construct a valid confidence set by taking the union of the confidence sets for each of its components.

This restriction provides a middle ground between the flexibility of \(\Delta^{SDRM}\) and the additional structure imposed by monotonicity, potentially yielding tighter confidence intervals when both assumptions are plausible.

References

[1]

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