Abstract
Economists specify high-dimensional models to address heterogeneity in empirical studies with complex big data. Estimation of these models calls for optimization techniques to handle a large number of parameters. Convex problems can be effectively executed in modern programming languages. We complement Koenker and Mizera (J Stat Softw 60(5):1–23, 2014)’s work on numerical implementation of convex optimization, with focus on high-dimensional econometric estimators. Combining R and the convex solver MOSEK achieves speed gain and accuracy, demonstrated by examples from Su et al. (Econometrica 84(6):2215–2264, 2016) and Shi (J Econom 195(1):104–119, 2016). Robust performance of convex optimization is witnessed across platforms. The convenience and reliability of convex optimization in R make it easy to turn new ideas into executable estimators.
Notes
At the writing of this note, CVXR + MOSEK takes from minutes to hours to compute one estimation depending on sample sizes, which makes the full-scale simulation exercise computational infeasible.
CVXR + MOSEK does not support exponential/logarithm objective functions and hence is infeasible for REL.
References
Bajari, P., Nekipelov, D., Ryan, S. P., & Yang, M. (2015). Machine learning methods for demand estimation. American Economic Review, 105(5), 481.
Chen, W., Chen, X., Hsieh, C.-T., & Song, Z. (2019). A forensic examination of China’s national accounts. Brookings Papers on Economic Activities Spring, 77–127. https://books.google.com.hk/books?hl=en&lr=&id=8kS8DwAAQBAJ&oi=fnd&pg=PA77&ots=84scMFLqBp&sig=m4yQpWnTftx6ly6mASjzGGO4FEY&redir_esc=y#v=onepage&q&f=false.
Diamond, S., & Boyd, S. (2016). CVXPY: A python-embedded modeling language for convex optimization. Journal of Machine Learning Research, 17(83), 1–5.
Domahidi, A., Chu, E., & Boyd, S. (2013). ECOS: An SOCP solver for embedded systems. European Control Conference (ECC), 2013, 3071–3076.
Doudchenko, N., & Imbens, G. W. (2016). Balancing, regression, difference-in-differences and synthetic control methods: A synthesis. Technical report, National Bureau of Economic Research No. 22791.
Fu, A., Balasubramanian, N., & Boyd, S. (2019). CVXR: An R package for disciplined convex optimization. Journal of Statistical Software, arxiv:1711.07582.
Grant, M., & Boyd, S. (2014). CVX: Matlab software for disciplined convex programming, version 2.1. http://cvxr.com/cvx.
Gu, J., & Koenker, R. (2017). Empirical bayesball remixed: Empirical bayes methods for longitudinal data. Journal of Applied Econometrics, 32(3), 575–599.
Johnson, S. G. (2017). The nloptnonlinear-optimization package.
Koenker, R., & Bassett, G. (1978). Regression quantiles. Econometrica, 46, 33–50.
Koenker, R., & Mizera, I. (2014). Convex optimization in R. Journal of Statistical Software, 60(5), 1–23.
Nash, J. C., & Varadhan, R. (2011). Unifying optimization algorithms to aid software system users: optimx for R. Journal of Statistical Software, 43(9), 1–14.
Shi, Z. (2016). Econometric estimation with high-dimensional moment equalities. Journal of Econometrics, 195(1), 104–119.
Su, L., & Ju, G. (2018). Identifying latent grouped patterns in panel data models with interactive fixed effects. Journal of Econometrics, 206(2), 554–573.
Su, L., & Lu, X. (2017). Determining the number of groups in latent panel structures with an application to income and democracy. Quantitative Economics, 8(3), 729–760.
Su, L., Shi, Z., & Phillips, P. C. (2016). Identifying latent structures in panel data. Econometrica, 84(6), 2215–2264.
Su, L., Wang, X., & Jin, S. (2019). Sieve estimation of time-varying panel data models with latent structures. Journal of Business & Economic Statistics, 37(2), 334–349.
Ypma, J. (2017). nloptr: R interface to NLopt R package version 1.0.4. https://cran.r-project.org/web/packages/nloptr/index.html.
Acknowledgements
Shi thanks Roger Koenker for inspiration and hospitality during his visit to University of Illinois.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Gao, Z., Shi, Z. Implementing Convex Optimization in R: Two Econometric Examples. Comput Econ 58, 1127–1135 (2021). https://doi.org/10.1007/s10614-020-09995-z
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10614-020-09995-z