moderndid.compute_conditional_cs_sdrmb#

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

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

Computes a confidence set for \(l'\tau_{post}\) under the restriction that delta lies in \(\Delta^{SDRMB}(\bar{M})\), which intersects \(\Delta^{SDRM}(\bar{M})\) with a sign restriction on the bias.

This combined restriction is defined in Section 2.4.4 of [1] as

\[\Delta^{SDRMB}(\bar{M}) = \Delta^{SDRM}(\bar{M}) \cap \Delta^{B}\]

where \(\Delta^{B}\) represents a sign restriction on the bias. For a positive bias,

\[\Delta^{B} = \Delta^{PB} = \{\delta : \delta_t \geq 0, \forall t \geq 0\},\]

and for a negative bias,

\[\Delta^{B} = \Delta^{NB} = \{\delta : \delta_t \leq 0, \forall t \geq 0\}.\]

This restriction combines three intuitions: smoothness of differential trends, relative magnitude bounds based on pre-treatment variation, and a known direction of bias.

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. 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’}, default=’LF’

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.

bias_direction{‘positive’, ‘negative’}, default=’positive’

Direction of bias sign restriction.

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, default=0

Random seed for reproducibility.

Returns:
dict

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’}.

Notes

The confidence set is constructed using the moment inequality approach from Section 3. Since \(\Delta^{SDRMB}(\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 is not convex, so Fixed Length Confidence Intervals (FLCIs) are not recommended. The conditional/hybrid approach provides better power when multiple constraints are binding.

References

[1]

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