moderndid.compute_arp_ci#
- moderndid.compute_arp_ci(beta_hat, sigma, A, d, n_pre_periods, n_post_periods, post_period_index=1, alpha=0.05, grid_lb=None, grid_ub=None, grid_points=1000, return_length=False, hybrid_flag='ARP', hybrid_kappa=None, flci_halflength=None, flci_l=None, lf_cv=None)[source]#
Compute Andrews-Roth-Pakes (ARP) confidence interval with no nuisance parameters.
Constructs confidence intervals for the parameter of interest \(\theta = l' \tau_{\text{post}}\) in the special case where \(\bar{T} = 1\) (single post-treatment period), which means there are no nuisance parameters \(\tilde{\tau}\) to profile over. This allows for more efficient computation compared to the general case.
For each value \(\bar{\theta}\) on a grid, the method tests the null hypothesis \(H_0: \theta = \bar{\theta}, \delta \in \Delta\) where \(\Delta = \{\delta: A \delta \leq d\}\). Following the results from [1], this is equivalent to testing whether there exists \(\tau_{\text{post}} \in \mathbb{R}^{\bar{T}}\) such that \(l' \tau_{\text{post}} = \bar{\theta}\) and
\[\mathbb{E}_{\hat{\beta}_n \sim \mathcal{N}(\delta+\tau, \Sigma_n)} [Y_n - A L_{\text{post}} \tau_{\text{post}}] \leq 0\]where \(Y_n = A \hat{\beta}_n - d\) and \(L_{\text{post}} = [0, I]'\).
In the no-nuisance case (\(\bar{T} = 1\)), the profiled test statistic from equation (14) in [2] simplifies to \(\hat{\eta} = \max_i (A \hat{\beta}_n - d)_i / \tilde{\sigma}_{n,i}\) where \(\tilde{\sigma}_{n,i} = \sqrt{(A \Sigma_n A')_{ii}}\). The test conditions on the event that constraint \(j = \arg\max_i (A \hat{\beta}_n - d)_i / \tilde{\sigma}_{n,i}\) is binding, leading to a truncated normal distribution for \(\hat{\eta}\).
- Parameters:
- beta_hat
numpy.ndarray Vector of estimated event study coefficients \(\hat{\beta}\). First n_pre_periods elements are pre-treatment, remainder are post-treatment.
- sigma
numpy.ndarray Covariance matrix \(\Sigma\) of estimated coefficients.
- A
numpy.ndarray Matrix \(A\) defining the constraint set \(\Delta\).
- d
numpy.ndarray Vector \(d\) such that \(\Delta = \{\delta : A\delta \leq d\}\).
- n_pre_periods
int Number of pre-treatment periods \(T_{pre}\).
- n_post_periods
int Number of post-treatment periods \(T_{post}\).
- post_period_index
int, default=1 Which post-treatment period \(s\) to compute CI for (1-indexed).
- alpha
float, default=0.05 Significance level \(\alpha\) for confidence interval.
- grid_lb
float, optional Lower bound for grid search. If None, uses \(\hat{\theta} - 10 \cdot SE(\hat{\theta})\).
- grid_ub
float, optional Upper bound for grid search. If None, uses \(\hat{\theta} + 10 \cdot SE(\hat{\theta})\).
- grid_points
int, default=1000 Number of points in the grid search.
- return_lengthbool, default=False
If True, only return the CI length (useful for power calculations).
- hybrid_flag{‘ARP’, ‘FLCI’, ‘LF’}, default=’ARP’
Type of test to use. ‘ARP’ is the standard conditional test, ‘FLCI’ adds fixed-length CI constraints for improved power, ‘LF’ uses a least favorable first stage.
- hybrid_kappa
float, optional First-stage size \(\kappa\) for hybrid tests. Required if hybrid_flag != ‘ARP’.
- flci_halflength
float, optional Half-length of FLCI constraint. Required if hybrid_flag == ‘FLCI’.
- flci_l
numpy.ndarray, optional Weight vector \(\ell\) for FLCI. Required if hybrid_flag == ‘FLCI’.
- lf_cv
float, optional Critical value for LF test. Required if hybrid_flag == ‘LF’.
- beta_hat
- Returns:
APRCIResultNamedTuple containing CI bounds, grid of tested values, acceptance indicators, and optimization status.
References