moderndid.compute_conditional_cs_sd#
- moderndid.compute_conditional_cs_sd(betahat, sigma, num_pre_periods, num_post_periods, l_vec=None, m_bar=0, alpha=0.05, hybrid_flag='FLCI', hybrid_kappa=None, post_period_moments_only=True, grid_points=1000, grid_lb=None, grid_ub=None, seed=None)[source]#
Compute conditional confidence set for \(\Delta^{SD}(M)\).
Computes a confidence set for \(l'\tau_{post}\) that is valid conditional on the event study coefficients being in the identified set under \(\Delta^{SD}(M)\).
The smoothness restriction \(\Delta^{SD}(M)\) formalizes the concern about confounding from secular trends that evolve smoothly over time. It bounds the discrete analog of the second derivative, as defined in Equation (8) of [3]
\[\Delta^{SD}(M) := \{\delta: |(\delta_{t+1} - \delta_t) - (\delta_t - \delta_{t-1})| \le M, \forall t\}.\]When \(M = 0\), this requires the differential trend to be exactly linear, corresponding to the common practice of controlling for linear group-specific trends. For \(M > 0\), it allows for approximate linearity, acknowledging that linear specifications may not be exactly correct.
- 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 \(\theta = l'\tau_{post}\). If None, defaults to first post-period.
- m_bar
float, default=0 Smoothness parameter M. Bounds the second differences: \(|\delta_{t-1} - 2\delta_t + \delta_{t+1}| \leq 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.
- 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:
dictReturns dict with ‘grid’ and ‘accept’ arrays.
Notes
\(\Delta^{SD}(M)\) is convex and centrosymmetric (i.e. \(\tilde{\delta} \in \Delta\) implies \(-\tilde{\delta} \in \Delta\)), which allows for the use of Fixed Length Confidence Intervals (FLCIs) with near-optimal finite-sample properties [2]. The identified set under \(\Delta^{SD}(M)\) has constant length \(2M\) regardless of the pre-treatment coefficients.
The confidence set is constructed using either FLCIs (default) or the moment inequality approach from Section 3 of [3]. For FLCIs, the expected length is at most 28% longer than the shortest possible confidence set satisfying the coverage requirement when the true parameter is at the center of the identified set (Proposition 4.1 in [2]).
References