  We study a new class of estimands in causal inference, which are the
solutions to a stochastic nonlinear optimization problem that in general cannot
be obtained in closed form. The optimization problem describes the
counterfactual state of a system after an intervention, and the solutions
represent the optimal decisions in that counterfactual state. In particular, we
develop a counterfactual mean-variance optimization approach, which can be used
for optimal allocation of resources after an intervention. We propose a
doubly-robust nonparametric estimator for the optimal solution of the
counterfactual mean-variance program. We go on to analyze rates of convergence
and provide a closed-form expression for the asymptotic distribution of our
estimator. Our analysis shows that the proposed estimator is robust against
nuisance model misspecification, and can attain fast $\sqrt{n}$ rates with
tractable inference even when using nonparametric methods. This result is
applicable to general nonlinear optimization problems subject to linear
constraints whose coefficients are unknown and must be estimated. In this way,
our findings contribute to the literature in optimization as well as causal
inference. We further discuss the problem of calibrating our counterfactual
covariance estimator to improve the finite-sample properties of our proposed
optimal solution estimators. Finally, we evaluate our methods via simulation,
and apply them to problems in healthcare policy and portfolio construction.
