moderndid.compute_arp_nuisance_ci#
- moderndid.compute_arp_nuisance_ci(betahat, sigma, l_vec, a_matrix, d_vec, num_pre_periods, num_post_periods, alpha=0.05, hybrid_flag='ARP', hybrid_list=None, grid_lb=None, grid_ub=None, grid_points=1000, rows_for_arp=None)[source]#
Compute Andrews-Roth-Pakes (ARP) confidence interval with nuisance parameters.
Computes confidence interval for \(\theta = l'\tau_{post}\) subject to the constraint that \(\delta \in \Delta\), where \(\Delta = \{\delta : A\delta \leq d\}\). This implements the conditional inference approach from Andrews, Roth & Pakes (2023) that provides uniformly valid inference over the identified set.
The method tests the composite null hypothesis from equation (12) in [2]
\[H_0: \exists \tau_{post} \in \mathbb{R}^{\bar{T}} \text{ s.t. } l'\tau_{post} = \bar{\theta} \text{ and } \mathbb{E}_{\hat{\beta}_n \sim \mathcal{N}(\delta+\tau, \Sigma_n)}[Y_n - AL_{post}\tau_{post}] \leq 0,\]where \(Y_n = A\hat{\beta}_n - d\) and \(L_{post} = [0, I]'\). After a change of basis using matrix \(\Gamma\) with \(l'\) as its first row, this becomes equation (13) in [2]
\[H_0: \exists \tilde{\tau} \in \mathbb{R}^{\bar{T}-1} \text{ s.t. } \mathbb{E}[\tilde{Y}_n(\bar{\theta}) - \tilde{X}\tilde{\tau}] \leq 0,\]where \(\tilde{Y}(\bar{\theta}) = Y_n - \tilde{A}_{(\cdot,1)}\bar{\theta}\) and \(\tilde{X} = \tilde{A}_{(\cdot,-1)}\).
- Parameters:
- betahat
numpy.ndarray Vector of estimated event study coefficients \(\hat{\beta}\).
- sigma
numpy.ndarray Covariance matrix \(\Sigma\) of betahat.
- l_vec
numpy.ndarray Vector \(l\) defining parameter of interest \(\theta = l'\tau_{post}\).
- a_matrix
numpy.ndarray Constraint matrix \(A\) defining the set \(\Delta\).
- d_vec
numpy.ndarray Constraint bounds \(d\) such that \(\Delta = \{\delta : A\delta \leq d\}\).
- num_pre_periods
int Number of pre-treatment periods \(T_{pre}\).
- num_post_periods
int Number of post-treatment periods \(T_{post}\).
- alpha
float, default=0.05 Significance level \(\alpha\) for confidence interval.
- hybrid_flag{‘ARP’, ‘LF’, ‘FLCI’}, default=’ARP’
Type of test to use. ‘ARP’ is the standard conditional test, ‘LF’ uses a least favorable critical value for the first stage, and ‘FLCI’ uses fixed-length confidence intervals for improved power.
- hybrid_list
dict, optional Parameters for hybrid tests, including hybrid_kappa (first-stage size), lf_cv (least favorable critical value), or FLCI parameters.
- grid_lb
float, optional Lower bound for grid search. If None, uses \(-20 \cdot SE(\theta)\).
- grid_ub
float, optional Upper bound for grid search. If None, uses \(20 \cdot SE(\theta)\).
- grid_points
int, default=1000 Number of grid points to test.
- rows_for_arp
numpy.ndarray, optional Subset of moments to use for ARP test. Useful when some moments are uninformative about post-treatment effects.
- betahat
- Returns:
ARPNuisanceCIResultNamedTuple containing CI bounds, acceptance grid, and length.
Notes
The method handles nuisance parameters by reparametrizing the problem using an invertible transformation \(\Gamma\) with \(l\) as its first row. This allows expressing the constraints in terms of \((\theta, \xi)\) where \(\xi\) are nuisance parameters. The test then profiles over \(\xi\) for each value of \(\theta\), using either primal or dual optimization depending on the conditioning set’s geometry.
The test controls size uniformly without requiring the linear independence constraint qualification (LICQ). However, when LICQ holds (i.e., gradients of binding constraints are linearly independent), Proposition 3.3 shows the conditional test achieves optimal local asymptotic power converging to the power envelope for tests controlling size in the finite-sample normal model.
References