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:
betahatnumpy.ndarray

Vector of estimated event study coefficients \(\hat{\beta}\).

sigmanumpy.ndarray

Covariance matrix \(\Sigma\) of betahat.

l_vecnumpy.ndarray

Vector \(l\) defining parameter of interest \(\theta = l'\tau_{post}\).

a_matrixnumpy.ndarray

Constraint matrix \(A\) defining the set \(\Delta\).

d_vecnumpy.ndarray

Constraint bounds \(d\) such that \(\Delta = \{\delta : A\delta \leq d\}\).

num_pre_periodsint

Number of pre-treatment periods \(T_{pre}\).

num_post_periodsint

Number of post-treatment periods \(T_{post}\).

alphafloat, 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_listdict, optional

Parameters for hybrid tests, including hybrid_kappa (first-stage size), lf_cv (least favorable critical value), or FLCI parameters.

grid_lbfloat, optional

Lower bound for grid search. If None, uses \(-20 \cdot SE(\theta)\).

grid_ubfloat, optional

Upper bound for grid search. If None, uses \(20 \cdot SE(\theta)\).

grid_pointsint, default=1000

Number of grid points to test.

rows_for_arpnumpy.ndarray, optional

Subset of moments to use for ARP test. Useful when some moments are uninformative about post-treatment effects.

Returns:
ARPNuisanceCIResult

NamedTuple 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

[1]

Andrews, I., Roth, J., & Pakes, A. (2023). Inference for Linear Conditional Moment Inequalities. Review of Economic Studies.

[2] (1,2)

Rambachan, A., & Roth, J. (2023). A more credible approach to parallel trends. Review of Economic Studies, 90(5), 2555-2591.