IDEAS home Printed from https://ideas.repec.org/a/kap/compec/v58y2021i4d10.1007_s10614-020-09983-3.html
   My bibliography  Save this article

Matlab, Python, Julia: What to Choose in Economics?

Author

Listed:
  • Chase Coleman

    (New York University)

  • Spencer Lyon

    (New York University)

  • Lilia Maliar

    (CUNY Graduate Center and CEPR)

  • Serguei Maliar

    (Santa Clara University)

Abstract

We perform a comparison of Matlab, Python and Julia as programming languages to be used for implementing global nonlinear solution techniques. We consider two popular applications: a neoclassical growth model and a new Keynesian model. The goal of our analysis is twofold: First, it is aimed at helping researchers in economics choose the programming language that is best suited to their applications and, if needed, help them transit from one programming language to another. Second, our collections of routines can be viewed as a toolbox with a special emphasis on techniques for dealing with high dimensional economic problems. We provide the routines in the three languages for constructing random and quasi-random grids, low-cost monomial integration, various global solution methods, routines for checking the accuracy of the solutions as well as examples of parallelization. Our global solution methods are not only accurate but also fast. Solving a new Keynesian model with eight state variables only takes a few seconds, even in the presence of an active zero lower bound on nominal interest rates. This speed is important because it allows the model to be solved repeatedly as would be required for estimation.

Suggested Citation

  • Chase Coleman & Spencer Lyon & Lilia Maliar & Serguei Maliar, 2021. "Matlab, Python, Julia: What to Choose in Economics?," Computational Economics, Springer;Society for Computational Economics, vol. 58(4), pages 1263-1288, December.
  • Handle: RePEc:kap:compec:v:58:y:2021:i:4:d:10.1007_s10614-020-09983-3
    DOI: 10.1007/s10614-020-09983-3
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1007/s10614-020-09983-3
    File Function: Abstract
    Download Restriction: Access to the full text of the articles in this series is restricted.

    File URL: https://libkey.io/10.1007/s10614-020-09983-3?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to look for a different version below or search for a different version of it.

    Other versions of this item:

    References listed on IDEAS

    as
    1. Stefan Laséen & Lars E.O. Svensson, 2011. "Anticipated Alternative policy Rate Paths in Plicy Simulations," International Journal of Central Banking, International Journal of Central Banking, vol. 7(3), pages 1-35, September.
    2. Yves Achdou & Jiequn Han & Jean-Michel Lasry & Pierre-Louis Lions & Benjamin Moll, 2017. "Income and Wealth Distribution in Macroeconomics: A Continuous-Time Approach," NBER Working Papers 23732, National Bureau of Economic Research, Inc.
    3. Kollmann, Robert & Kim, Jinill & Kim, Sunghyun H., 2011. "Solving the multi-country Real Business Cycle model using a perturbation method," Journal of Economic Dynamics and Control, Elsevier, vol. 35(2), pages 203-206, February.
    4. Maliar, Lilia & Maliar, Serguei, 2013. "Envelope condition method versus endogenous grid method for solving dynamic programming problems," Economics Letters, Elsevier, vol. 120(2), pages 262-266.
    5. Kenneth L. Judd & Lilia Maliar & Serguei Maliar, 2011. "Numerically stable and accurate stochastic simulation approaches for solving dynamic economic models," Quantitative Economics, Econometric Society, vol. 2(2), pages 173-210, July.
    6. Guerrieri, Luca & Iacoviello, Matteo, 2015. "OccBin: A toolkit for solving dynamic models with occasionally binding constraints easily," Journal of Monetary Economics, Elsevier, vol. 70(C), pages 22-38.
    7. Lilia Maliar & Serguei Maliar & John B. Taylor & Inna Tsener, 2020. "A tractable framework for analyzing a class of nonstationary Markov models," Quantitative Economics, Econometric Society, vol. 11(4), pages 1289-1323, November.
    8. Arellano, Cristina & Maliar, Lilia & Maliar, Serguei & Tsyrennikov, Viktor, 2016. "Envelope condition method with an application to default risk models," Journal of Economic Dynamics and Control, Elsevier, vol. 69(C), pages 436-459.
    9. Lepetyuk, Vadym & Maliar, Lilia & Maliar, Serguei, 2020. "When the U.S. catches a cold, Canada sneezes: A lower-bound tale told by deep learning," Journal of Economic Dynamics and Control, Elsevier, vol. 117(C).
    10. Carroll, Christopher D., 2006. "The method of endogenous gridpoints for solving dynamic stochastic optimization problems," Economics Letters, Elsevier, vol. 91(3), pages 312-320, June.
    11. Del Negro, Marco & Schorfheide, Frank & Smets, Frank & Wouters, Rafael, 2007. "On the Fit of New Keynesian Models," Journal of Business & Economic Statistics, American Statistical Association, vol. 25, pages 123-143, April.
    12. Taylor, John B & Uhlig, Harald, 1990. "Solving Nonlinear Stochastic Growth Models: A Comparison of Alternative Solution Methods," Journal of Business & Economic Statistics, American Statistical Association, vol. 8(1), pages 1-17, January.
    13. Frank Smets & Rafael Wouters, 2007. "Shocks and Frictions in US Business Cycles: A Bayesian DSGE Approach," American Economic Review, American Economic Association, vol. 97(3), pages 586-606, June.
    14. Stefan Laséen & Lars E.O. Svensson, 2009. "Anticipated Alternative Instrument-Rate Paths in Policy Simulations," NBER Working Papers 14902, National Bureau of Economic Research, Inc.
    15. Santos, Manuel S., 1999. "Numerical solution of dynamic economic models," Handbook of Macroeconomics, in: J. B. Taylor & M. Woodford (ed.), Handbook of Macroeconomics, edition 1, volume 1, chapter 5, pages 311-386, Elsevier.
    16. Fernández-Villaverde, J. & Rubio-Ramírez, J.F. & Schorfheide, F., 2016. "Solution and Estimation Methods for DSGE Models," Handbook of Macroeconomics, in: J. B. Taylor & Harald Uhlig (ed.), Handbook of Macroeconomics, edition 1, volume 2, chapter 0, pages 527-724, Elsevier.
    17. Barillas, Francisco & Fernandez-Villaverde, Jesus, 2007. "A generalization of the endogenous grid method," Journal of Economic Dynamics and Control, Elsevier, vol. 31(8), pages 2698-2712, August.
    18. Manuel Santos & John Rust, "undated". "Convergence Properties of Policy Iteration," Working Papers 2133377, Department of Economics, W. P. Carey School of Business, Arizona State University.
    19. Jasmina Hasanhodzic & Laurence J. Kotlikoff, 2013. "Generational Risk–Is It a Big Deal?: Simulating an 80-Period OLG Model with Aggregate Shocks," BYU Macroeconomics and Computational Laboratory Working Paper Series 2013-01, Brigham Young University, Department of Economics, BYU Macroeconomics and Computational Laboratory.
    20. Cristina Arellano, 2008. "Default Risk and Income Fluctuations in Emerging Economies," American Economic Review, American Economic Association, vol. 98(3), pages 690-712, June.
    21. Kenneth L. Judd, 1998. "Numerical Methods in Economics," MIT Press Books, The MIT Press, edition 1, volume 1, number 0262100711, December.
    22. Fernández-Villaverde, Jesús & Zarruk Valencia , David, 2018. "A Practical Guide to Parallelization in Economics," CEPR Discussion Papers 12890, C.E.P.R. Discussion Papers.
    23. Nicolas Petrosky‐Nadeau & Lu Zhang, 2017. "Solving the Diamond–Mortensen–Pissarides model accurately," Quantitative Economics, Econometric Society, vol. 8(2), pages 611-650, July.
    24. Lilia Maliar & Serguei Maliar, 2015. "Merging simulation and projection approaches to solve high‐dimensional problems with an application to a new Keynesian model," Quantitative Economics, Econometric Society, vol. 6(1), pages 1-47, March.
    25. Vadym Lepetyuk & Lilia Maliar & Serguei Maliar, 2017. "Should Central Banks Worry About Nonlinearities of their Large-Scale Macroeconomic Models?," Staff Working Papers 17-21, Bank of Canada.
    26. Per Krusell & Anthony A. Smith & Jr., 1998. "Income and Wealth Heterogeneity in the Macroeconomy," Journal of Political Economy, University of Chicago Press, vol. 106(5), pages 867-896, October.
    27. Maliar, Serguei & Winant, Pablo, 2019. "Will Artificial Intelligence Replace Computational Economists Any Time Soon?," CEPR Discussion Papers 14024, C.E.P.R. Discussion Papers.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. S. Bogan Aruoba & Pablo Cuba-Borda & Kenji Higa-Flores & Frank Schorfheide & Sergio Villalvazo, 2021. "Piecewise-Linear Approximations and Filtering for DSGE Models with Occasionally Binding Constraints," Review of Economic Dynamics, Elsevier for the Society for Economic Dynamics, vol. 41, pages 96-120, July.
    2. Miroslav Gabrovski & Mario Rafael Silva, 2023. "Unemployment and Labor Productivity Co-movement: the Role of Firm Exit," Working Papers 202301, University of Hawaii at Manoa, Department of Economics.
    3. Maliar, Lilia & Maliar, Serguei & Winant, Pablo, 2021. "Deep learning for solving dynamic economic models," Journal of Monetary Economics, Elsevier, vol. 122(C), pages 76-101.
    4. Duarte, Victor & Duarte, Diogo & Fonseca, Julia & Montecinos, Alexis, 2020. "Benchmarking machine-learning software and hardware for quantitative economics," Journal of Economic Dynamics and Control, Elsevier, vol. 111(C).
    5. S. Bogan Aruoba & Pablo Cuba-Borda & Kenji Higa-Flores & Frank Schorfheide & Sergio Villalvazo, 2021. "Piecewise-Linear Approximations and Filtering for DSGE Models with Occasionally Binding Constraints," Review of Economic Dynamics, Elsevier for the Society for Economic Dynamics, vol. 41, pages 96-120, July.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Arellano, Cristina & Maliar, Lilia & Maliar, Serguei & Tsyrennikov, Viktor, 2016. "Envelope condition method with an application to default risk models," Journal of Economic Dynamics and Control, Elsevier, vol. 69(C), pages 436-459.
    2. Serguei Maliar & John Taylor & Lilia Maliar, 2016. "The Impact of Alternative Transitions to Normalized Monetary Policy," 2016 Meeting Papers 794, Society for Economic Dynamics.
    3. Lepetyuk, Vadym & Maliar, Lilia & Maliar, Serguei, 2020. "When the U.S. catches a cold, Canada sneezes: A lower-bound tale told by deep learning," Journal of Economic Dynamics and Control, Elsevier, vol. 117(C).
    4. Lilia Maliar & Serguei Maliar & John B. Taylor & Inna Tsener, 2020. "A tractable framework for analyzing a class of nonstationary Markov models," Quantitative Economics, Econometric Society, vol. 11(4), pages 1289-1323, November.
    5. Maliar, Lilia & Maliar, Serguei & Winant, Pablo, 2021. "Deep learning for solving dynamic economic models," Journal of Monetary Economics, Elsevier, vol. 122(C), pages 76-101.
    6. Ayşe Kabukçuoğlu & Enrique Martínez-García, 2021. "A Generalized Time Iteration Method for Solving Dynamic Optimization Problems with Occasionally Binding Constraints," Computational Economics, Springer;Society for Computational Economics, vol. 58(2), pages 435-460, August.
    7. Fernández-Villaverde, J. & Rubio-Ramírez, J.F. & Schorfheide, F., 2016. "Solution and Estimation Methods for DSGE Models," Handbook of Macroeconomics, in: J. B. Taylor & Harald Uhlig (ed.), Handbook of Macroeconomics, edition 1, volume 2, chapter 0, pages 527-724, Elsevier.
    8. Yasuo Hirose & Takeki Sunakawa, 2019. "Review of Solution and Estimation Methods for Nonlinear Dynamic Stochastic General Equilibrium Models with the Zero Lower Bound," The Japanese Economic Review, Springer, vol. 70(1), pages 51-104, March.
    9. Kenneth L. Judd & Lilia Maliar & Serguei Maliar, 2014. "Lower Bounds on Approximation Errors: Testing the Hypothesis That a Numerical Solution Is Accurate?," BYU Macroeconomics and Computational Laboratory Working Paper Series 2014-06, Brigham Young University, Department of Economics, BYU Macroeconomics and Computational Laboratory.
    10. Yongyang Cai & Kenneth L. Judd, 2023. "A simple but powerful simulated certainty equivalent approximation method for dynamic stochastic problems," Quantitative Economics, Econometric Society, vol. 14(2), pages 651-687, May.
    11. Marlon Azinovic & Luca Gaegauf & Simon Scheidegger, 2022. "Deep Equilibrium Nets," International Economic Review, Department of Economics, University of Pennsylvania and Osaka University Institute of Social and Economic Research Association, vol. 63(4), pages 1471-1525, November.
    12. Lilia Maliar & Serguei Maliar, 2016. "Ruling Out Multiplicity of Smooth Equilibria in Dynamic Games: A Hyperbolic Discounting Example," Dynamic Games and Applications, Springer, vol. 6(2), pages 243-261, June.
    13. Maliar, Lilia & Maliar, Serguei, 2022. "Deep learning classification: Modeling discrete labor choice," Journal of Economic Dynamics and Control, Elsevier, vol. 135(C).
    14. Adrien Auclert & Bence Bardóczy & Matthew Rognlie & Ludwig Straub, 2021. "Using the Sequence‐Space Jacobian to Solve and Estimate Heterogeneous‐Agent Models," Econometrica, Econometric Society, vol. 89(5), pages 2375-2408, September.
    15. Judd, Kenneth L. & Maliar, Lilia & Maliar, Serguei & Valero, Rafael, 2014. "Smolyak method for solving dynamic economic models: Lagrange interpolation, anisotropic grid and adaptive domain," Journal of Economic Dynamics and Control, Elsevier, vol. 44(C), pages 92-123.
    16. Julien Albertini & Stéphane Moyen, 2020. "A General and Efficient Method for Solving Regime-Switching DSGE Models," Working Papers halshs-03067554, HAL.
    17. Guerra Vallejos, Ernesto & Bobenrieth Hochfarber, Eugenio & Bobenrieth Hochfarber, Juan & Wright, Brian D., 2021. "Solving dynamic stochastic models with multiple occasionally binding constraints," Economic Modelling, Elsevier, vol. 105(C).
    18. Ayse Kabukcuoglu & Enrique Martínez-García, 2016. "The Market Resources Method for Solving Dynamic Optimization Problems," Koç University-TUSIAD Economic Research Forum Working Papers 1607, Koc University-TUSIAD Economic Research Forum.
    19. Gauti Eggertsson & Sergey Egiev & Alessandro Lin & Josef Platzer & Luca Riva, 2021. "A Toolkit for Solving Models with a Lower Bound on Interest Rates of Stochastic Duration," Review of Economic Dynamics, Elsevier for the Society for Economic Dynamics, vol. 41, pages 121-173, July.
    20. Jang, Youngsoo & Lee, Soyoung, 2019. "A Generalized Endogenous Grid Method for Models with the Option to Default," MPRA Paper 95721, University Library of Munich, Germany.

    More about this item

    Keywords

    Toolkit; Dynamic model; New Keynesian model; Global nonlinear; Low discrepancy; Quasi Monte Carlo;
    All these keywords.

    JEL classification:

    • C6 - Mathematical and Quantitative Methods - - Mathematical Methods; Programming Models; Mathematical and Simulation Modeling
    • C61 - Mathematical and Quantitative Methods - - Mathematical Methods; Programming Models; Mathematical and Simulation Modeling - - - Optimization Techniques; Programming Models; Dynamic Analysis
    • C63 - Mathematical and Quantitative Methods - - Mathematical Methods; Programming Models; Mathematical and Simulation Modeling - - - Computational Techniques
    • C68 - Mathematical and Quantitative Methods - - Mathematical Methods; Programming Models; Mathematical and Simulation Modeling - - - Computable General Equilibrium Models
    • E31 - Macroeconomics and Monetary Economics - - Prices, Business Fluctuations, and Cycles - - - Price Level; Inflation; Deflation
    • E52 - Macroeconomics and Monetary Economics - - Monetary Policy, Central Banking, and the Supply of Money and Credit - - - Monetary Policy

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:kap:compec:v:58:y:2021:i:4:d:10.1007_s10614-020-09983-3. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.