moderndid.compute_least_favorable_cv#
- moderndid.compute_least_favorable_cv(x_t=None, sigma=None, hybrid_kappa=0.05, sims=1000, rows_for_arp=None, seed=0)[source]#
Compute least favorable critical value.
Computes the critical value \(c_{LF,\kappa}\) for the least favorable (LF) hybrid test, which uses a data-dependent first stage that rejects for large values of the test statistic \(\hat{\eta}\). The LF critical value is the \((1-\kappa)\) quantile of \(\max_{\gamma \in V(\Sigma)} \gamma'\xi\) where \(\xi \sim \mathcal{N}(0, \tilde{\Sigma}_n)\).
The least favorable distribution assumes \(\tilde{\mu}(\bar{\theta}) = 0\), which maximizes the rejection probability under the null. Since the distribution of \(\hat{\eta}\) under the null is bounded above (in first-order stochastic dominance) by its distribution when \(\tilde{\mu}(\bar{\theta}) = 0\), this ensures size control.
For the hybrid test, if \(\hat{\eta} > c_{LF,\kappa}\), the first stage rejects. Otherwise, the second stage applies a modified conditional test with size \((\alpha - \kappa)/(1 - \kappa)\) that conditions on \(\hat{\eta} \leq c_{LF,\kappa}\).
- Parameters:
- x_t
numpy.ndarrayorNone Covariate matrix \(X_T\) for nuisance parameters. If None, the test has no nuisance parameters.
- sigma
numpy.ndarray Covariance matrix \(\Sigma_Y\) of the moments.
- hybrid_kappa
float First-stage size \(\kappa\), typically \(\alpha/10\).
- sims
int Number of Monte Carlo simulations for critical value computation.
- rows_for_arp
numpy.ndarray, optional Subset of rows to use, focusing on informative moments.
- seed
intorNone Random seed for reproducibility.
- x_t
- Returns:
floatLeast favorable critical value \(c_{LF}\) such that \(\mathbb{P}(\eta^* > c_{LF}) = \kappa\) under the least favorable distribution.
Notes
Without nuisance parameters, the least favorable distribution is standard multivariate normal and \(\eta^* = \max_i Z_i/\sigma_i\) where \(Z_i\) are the standardized moments. With nuisance parameters, each simulation requires solving the linear program to account for optimization over \(\xi\).
References
[1]Andrews, I., Roth, J., & Pakes, A. (2023). Inference for Linear Conditional Moment Inequalities. Review of Economic Studies.
[2]Rambachan, A., & Roth, J. (2023). A more credible approach to parallel trends. Review of Economic Studies, 90(5), 2555-2591.