moderndid.minimize_variance#

moderndid.minimize_variance(sigma, n_pre_periods, n_post_periods, post_period_weights)[source]#

Find the minimum achievable standard deviation \(h\).

Solves a Quadratic Program (QP) to find the minimum variance of an affine estimator subject to bias constraints arising from \(\Delta^{SD}(M)\). The optimization problem is formulated as

\[\begin{split}\min_{w, t} \quad & \text{Var}(\ell'_{pre}\hat{\beta}_{pre} + \ell'_{post}\hat{\beta}_{post}) \\ \text{s.t.} \quad & -t_s \leq \sum_{j=-\underline{T}+1}^{s} w_j \leq t_s, \quad \forall s \\ & \sum_{s=-\underline{T}+1}^{0} w_s = \sum_{s=1}^{\bar{T}} s \cdot \ell_{post,s}.\end{split}\]

The variance is a quadratic function of the first-difference weights \(w\), making this a QP. The problem is solved using an interior-point method from [2]. The solution provides a lower bound for the feasible values of \(h\) in the FLCI optimization.

Parameters:
sigmanumpy.ndarray

Covariance matrix \(\Sigma\) of event study coefficients.

n_pre_periodsint

Number of pre-treatment periods.

n_post_periodsint

Number of post-treatment periods.

post_period_weightsnumpy.ndarray

Post-treatment weight vector \(\ell_{post}\).

Returns:
float

Minimum achievable standard deviation \(h_{min}\).

References

[1]

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

[2]

Goulart, P. J., & Chen, Y. (2024). Clarabel: An interior-point solver for conic programs with quadratic objectives. arXiv preprint arXiv:2405.13033.