IDEAS home Printed from https://ideas.repec.org/a/ebl/ecbull/eb-16-00719.html
   My bibliography  Save this article

Getting the most from MATLAB: ditching canned routines and embracing coder

Author

Listed:
  • John Gibson

    (Department of Economics, Georgia State University)

  • James P Henson

    (Department of Economics, Georgia State University)

Abstract

This paper demonstrates the efficiency gains that can be realized by replacing canned routine calls within MATLAB with user-generated versions that simplify the underlying computations. Once canned routines have been replaced, we integrate C++ executables (or MEX files) using MATLAB's Coder to automatically convert our MATLAB code. We demonstrate these efficiency gains by computing the stationary equilibria and associated transition path for an economy with incomplete insurance markets following a change in government debt policy. The combined process of replacing calls to canned routines and integrating MEX files reduces our runtime from just over 24 hours to approximately 16 minutes.

Suggested Citation

  • John Gibson & James P Henson, 2016. "Getting the most from MATLAB: ditching canned routines and embracing coder," Economics Bulletin, AccessEcon, vol. 36(4), pages 2519-2525.
  • Handle: RePEc:ebl:ecbull:eb-16-00719
    as

    Download full text from publisher

    File URL: http://www.accessecon.com/Pubs/EB/2016/Volume36/EB-16-V36-I4-P243.pdf
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Lilia Maliar, 2015. "Assessing gains from parallel computation on a supercomputer," Economics Bulletin, AccessEcon, vol. 35(1), pages 159-167.
    2. Chatterjee, Santanu & Gibson, John & Rioja, Felix, 2017. "Optimal public debt redux," Journal of Economic Dynamics and Control, Elsevier, vol. 83(C), pages 162-174.
    3. Burkhard Heer & Alfred Maußner, 2024. "Dynamic General Equilibrium Modeling," Springer Texts in Business and Economics, Springer, edition 3, number 978-3-031-51681-8, June.
    4. Aldrich, Eric M. & Fernández-Villaverde, Jesús & Ronald Gallant, A. & Rubio-Ramírez, Juan F., 2011. "Tapping the supercomputer under your desk: Solving dynamic equilibrium models with graphics processors," Journal of Economic Dynamics and Control, Elsevier, vol. 35(3), pages 386-393, March.
    5. Mathur, Sudhanshu & Morozov, Sergei, 2009. "Massively Parallel Computation Using Graphics Processors with Application to Optimal Experimentation in Dynamic Control," MPRA Paper 16721, University Library of Munich, Germany.
    6. Kenneth L. Judd, 1998. "Numerical Methods in Economics," MIT Press Books, The MIT Press, edition 1, volume 1, number 0262100711, December.
    7. Aiyagari, S. Rao & McGrattan, Ellen R., 1998. "The optimum quantity of debt," Journal of Monetary Economics, Elsevier, vol. 42(3), pages 447-469, October.
    8. David Domeij & Jonathan Heathcote, 2004. "On The Distributional Effects Of Reducing Capital Taxes," International Economic Review, Department of Economics, University of Pennsylvania and Osaka University Institute of Social and Economic Research Association, vol. 45(2), pages 523-554, May.
    9. Sergei Morozov & Sudhanshu Mathur, 2012. "Massively Parallel Computation Using Graphics Processors with Application to Optimal Experimentation in Dynamic Control," Computational Economics, Springer;Society for Computational Economics, vol. 40(2), pages 151-182, August.
    10. Tauchen, George, 1986. "Finite state markov-chain approximations to univariate and vector autoregressions," Economics Letters, Elsevier, vol. 20(2), pages 177-181.
    11. Matt Dziubinski & Stefano Grassi, 2014. "Heterogeneous Computing in Economics: A Simplified Approach," Computational Economics, Springer;Society for Computational Economics, vol. 43(4), pages 485-495, April.
    12. Unknown, 1986. "Letters," Choices: The Magazine of Food, Farm, and Resource Issues, Agricultural and Applied Economics Association, vol. 1(4), pages 1-9.
    Full references (including those not matched with items on IDEAS)

    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. Matt Dziubinski & Stefano Grassi, 2014. "Heterogeneous Computing in Economics: A Simplified Approach," Computational Economics, Springer;Society for Computational Economics, vol. 43(4), pages 485-495, April.
    2. Zuzana Mucka & Ludovit Odor, 2018. "Optimal sovereign debt: Case of Slovakia," Working Papers Working Paper No. 3/2018, Council for Budget Responsibility.
    3. Aldrich, EM, 2014. "GPU Computing in Economics," Santa Cruz Department of Economics, Working Paper Series qt8p12748g, Department of Economics, UC Santa Cruz.
    4. Andrew Foerster & Juan F. Rubio‐Ramírez & Daniel F. Waggoner & Tao Zha, 2016. "Perturbation methods for Markov‐switching dynamic stochastic general equilibrium models," Quantitative Economics, Econometric Society, vol. 7(2), pages 637-669, July.
    5. Hull, Isaiah, 2015. "Approximate dynamic programming with post-decision states as a solution method for dynamic economic models," Journal of Economic Dynamics and Control, Elsevier, vol. 55(C), pages 57-70.
    6. Roberto Casarin & Stefano Grassi & Francesco Ravazzolo & Herman K. van Dijk, 2015. "Dynamic predictive density combinations for large data sets in economics and finance," Working Paper 2015/12, Norges Bank.
    7. Casarin, Roberto & Grassi, Stefano & Ravazzolo, Francesco & van Dijk, Herman K., 2015. "Parallel Sequential Monte Carlo for Efficient Density Combination: The DeCo MATLAB Toolbox," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 68(i03).
    8. Yikai Wang & Hans Holter & Marcus Hagedorn, 2015. "The Optimum Quantity of Capital and Debt," 2015 Meeting Papers 1220, Society for Economic Dynamics.
    9. Nalan Baştürk & Stefano Grassi & Lennart Hoogerheide & Herman K. Van Dijk, 2016. "Parallelization Experience with Four Canonical Econometric Models Using ParMitISEM," Econometrics, MDPI, vol. 4(1), pages 1-20, March.
    10. Kartik B. Athreya & Andrea L. Waddle, 2007. "Implications of some alternatives to capital income taxation," Economic Quarterly, Federal Reserve Bank of Richmond, vol. 93(Win), pages 31-55.
    11. Hsu, Minchung & Yang, C.C., 2013. "Optimal linear and two-bracket income taxes with idiosyncratic earnings risk," Journal of Public Economics, Elsevier, vol. 105(C), pages 58-71.
    12. 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.
    13. Yongyang Cai & Kenneth Judd & Greg Thain & Stephen Wright, 2015. "Solving Dynamic Programming Problems on a Computational Grid," Computational Economics, Springer;Society for Computational Economics, vol. 45(2), pages 261-284, February.
    14. Fève, Patrick & Matheron, Julien & Sahuc, Jean-Guillaume, 2012. "The Laffer Curve in an Incomplete-Market Economy," TSE Working Papers 12-288, Toulouse School of Economics (TSE), revised Jul 2013.
    15. Michael C. Hatcher & Eric M. Scheffel, 2016. "Solving the Incomplete Markets Model in Parallel Using GPU Computing and the Krusell–Smith Algorithm," Computational Economics, Springer;Society for Computational Economics, vol. 48(4), pages 569-591, December.
    16. D’Erasmo, P. & Mendoza, E.G. & Zhang, J., 2016. "What is a Sustainable Public Debt?," Handbook of Macroeconomics, in: J. B. Taylor & Harald Uhlig (ed.), Handbook of Macroeconomics, edition 1, volume 2, chapter 0, pages 2493-2597, Elsevier.
    17. Röhrs, Sigrid & Winter, Christoph, 2017. "Reducing government debt in the presence of inequality," Journal of Economic Dynamics and Control, Elsevier, vol. 82(C), pages 1-20.
    18. Marta González-Torrabadella & Josep Pijoan-Mas, 2006. "Flat tax reforms: a general equilibrium evaluation for Spain," Investigaciones Economicas, Fundación SEPI, vol. 30(2), pages 317-351, May.
    19. Andrés Erosa & Luisa Fuster & Gueorgui Kambourov, 2016. "Towards a Micro-Founded Theory of Aggregate Labour Supply," The Review of Economic Studies, Review of Economic Studies Ltd, vol. 83(3), pages 1001-1039.
    20. Constantine Angyridis & Brennan Scott Thompson, 2016. "Negative income taxes, inequality and poverty," Canadian Journal of Economics, Canadian Economics Association, vol. 49(3), pages 1016-1034, August.

    More about this item

    Keywords

    MATLAB; C++; MATLAB Coder; Incomplete Markets; Stationary Distribution; Transitional Dynamics;
    All these keywords.

    JEL classification:

    • C6 - Mathematical and Quantitative Methods - - Mathematical Methods; Programming Models; Mathematical and Simulation Modeling
    • E2 - Macroeconomics and Monetary Economics - - Consumption, Saving, Production, Employment, and Investment

    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:ebl:ecbull:eb-16-00719. 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: John P. Conley (email available below). General contact details of provider: .

    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.