moderndid.compute_conditional_cs_rmb#

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

Compute conditional confidence set for \(\Delta^{RM}(\bar{M})\) with bias sign restrictions.

Computes a confidence set for \(l'\tau_{post}\) under the restriction that \(\delta\) lies in the intersection of the relative magnitudes set \(\Delta^{RM}(\bar{M})\) and a bias sign restriction set \(\Delta^{B}\).

The combined restriction is defined as the intersection of the sets from Sections 2.4.1 and 2.4.4 of [2]

\[\Delta^{RMB}(\bar{M}) = \Delta^{RM}(\bar{M}) \cap \Delta^{B},\]

where \(\Delta^{B}\) is \(\Delta^{PB} = \{\delta: \delta_t \ge 0 \, \forall t \ge 0\}\) for positive bias, or \(-\Delta^{PB}\) for negative bias. This is useful when there is prior knowledge about the direction of the bias.

Since \(\Delta^{RMB}(\bar{M})\) is a finite union of polyhedra, a valid confidence set is constructed by taking the union of confidence sets for each component polyhedron, following Lemma 2.2 of [2].

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

Relative magnitude parameter \(\bar{M}\).

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.

return_lengthbool, default=False

If True, return only the length of the confidence interval.

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

Direction of bias sign 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

If return_length is False, returns dict with ‘grid’ and ‘accept’ arrays. If return_length is True, returns the length of the confidence interval.

Notes

The confidence set is constructed using the moment inequality approach from [1], as described in Section 3 of [2]. The intersection of \(\Delta^{RM}(\bar{M})\) and \(\Delta^{B}\) forms a finite union of polyhedra (Section 2.4.5 of [2]), allowing the application of Lemma 2.2 for constructing a valid confidence set. The sign restriction on the bias often sharpens the identified set.

References

[1]

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

[2] (1,2,3,4)

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