moderndid.compute_conditional_cs_rmm#
- moderndid.compute_conditional_cs_rmm(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, 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^{RMI}(\bar{M})\).
Computes a confidence set for \(l'\tau_{post}\) under the restriction that \(\delta\) lies in \(\Delta^{RMI}(\bar{M})\), which combines the relative magnitudes restriction with a monotonicity constraint.
The combined restriction is defined in Section 2.4.4 of [2] as
\[\Delta^{RMI}(\bar{M}) = \Delta^{RM}(\bar{M}) \cap \Delta^{I},\]where \(\Delta^{I} = \{\delta: \delta_t \ge \delta_{t-1} \, \forall t\}\) for increasing monotonicity. This is useful when there is prior knowledge that the trend is monotonic.
Since \(\Delta^{RMI}(\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.
- 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_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^{I}\) 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 monotonicity restriction can sharpen the identified set.
References