moderndid.compute_conditional_cs_sdb#
- moderndid.compute_conditional_cs_sdb(betahat, sigma, num_pre_periods, num_post_periods, l_vec=None, m_bar=0, alpha=0.05, hybrid_flag='FLCI', hybrid_kappa=None, bias_direction='positive', post_period_moments_only=True, grid_points=1000, grid_lb=None, grid_ub=None)[source]#
Compute conditional confidence set for \(\Delta^{SDB}(M)\).
Computes a confidence set for \(l'\tau_{post}\) that is valid conditional on the event study coefficients being in the identified set under the second differences with bias restriction \(\Delta^{SDB}(M)\).
The combined smoothness and bias direction restriction is defined as the intersection of \(\Delta^{SD}(M)\) and a sign restriction on the bias. For a positive bias, this is denoted \(\Delta^{SDPB}(M)\) in [2]
\[\Delta^{SDPB}(M) := \Delta^{SD}(M) \cap \Delta^{PB},\]where
\[\Delta^{SD}(M) := \{\delta: |(\delta_{t+1} - \delta_t) - (\delta_t - \delta_{t-1})| \le M, \forall t\},\]and \(\Delta^{PB} := \{\delta: \delta_t \ge 0, \forall t \ge 0\}\). For a negative bias, the restriction is \(\Delta^{SD}(M) \cap (-\Delta^{PB})\).
This restriction is useful when economic theory suggests both smooth evolution of confounding trends and a known direction of bias (e.g., a concurrent policy expected to have a positive effect). The intersection typically leads to smaller identified sets than using either restriction alone.
- 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 Smoothness parameter M for \(\Delta^{SDB}(M)\).
- alpha
float, default=0.05 Significance level.
- hybrid_flag{‘FLCI’, ‘LF’, ‘ARP’}, default=’FLCI’
Type of hybrid test.
- hybrid_kappa
float, optional First-stage size for hybrid test. If None, defaults to alpha/10.
- bias_direction{‘positive’, ‘negative’}, default=’positive’
Direction of bias sign restriction. ‘positive’ means treatment effects are non-negative, ‘negative’ means non-positive.
- 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
\(\Delta^{SDB}(M)\) is a polyhedron formed by the intersection of smoothness and sign constraints. The confidence set is constructed using either FLCIs or the moment inequality approach from Section 3 of [2].
Unlike \(\Delta^{SD}(M)\) alone, the optimal FLCI for \(\Delta^{SDB}(M)\) has the same worst-case bias as for \(\Delta^{SD}(M)\), meaning FLCIs do not adapt to the additional sign restriction. The conditional/hybrid approach may therefore have better power when the sign restriction is informative.
References