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:
- betahat
numpy.ndarray Estimated event study coefficients.
- sigma
numpy.ndarray Covariance matrix of betahat.
- num_pre_periods
int Number of pre-treatment periods.
- num_post_periods
int Number of post-treatment periods.
- l_vec
numpy.ndarray, optional Vector defining parameter of interest. If None, defaults to first post-period.
- m_bar
float, default=0 Relative magnitude parameter \(\bar{M}\).
- alpha
float, default=0.05 Significance level.
- hybrid_flag{‘LF’, ‘ARP’}, default=’LF’
Type of hybrid test.
- hybrid_kappa
float, 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_points
int, default=1000 Number of grid points for confidence interval search.
- grid_lb
float, optional Lower bound for grid search.
- grid_ub
float, optional Upper bound for grid search.
- seed
int, optional Random seed for reproducibility.
- betahat
- Returns:
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