{"id":2639,"date":"2026-02-26T09:54:53","date_gmt":"2026-02-26T09:54:53","guid":{"rendered":"https:\/\/blogs.mathworks.com\/finance\/?p=2639"},"modified":"2026-03-02T15:58:03","modified_gmt":"2026-03-02T15:58:03","slug":"refining-macroeconomic-forecasting-with-matlab-techniques","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/finance\/2026\/02\/26\/refining-macroeconomic-forecasting-with-matlab-techniques\/","title":{"rendered":"Refining Macroeconomic Forecasting with MATLAB Techniques"},"content":{"rendered":"<p>Nonlinear confidence bands help you quantify forecast uncertainty in DSGE models, but they can be slow to compute. At the MathWorks Finance Conference, Kadir Tanyeri (International Monetary Fund) showed a MATLAB workflow that cut simulations from more than 100,000 to about 3,600 and reduced runtime from months to overnight.<\/p>\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<div class=\"is-content-justification-left is-layout-flex wp-container-1 wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-white-color has-text-color has-background wp-element-button\" href=\"https:\/\/uk.mathworks.com\/videos\/nonlinear-confidence-bands-computation-in-matlab-1699376371844.html\" style=\"background-color:#0076a8\" target=\"_blank\" rel=\"noreferrer noopener\">Watch the presentation<\/a><\/div>\n<\/div>\n<div style=\"height:52px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h1>Why Confidence Bands Matter<\/h1>\n<p>Macroeconomic projections\u2014such as GDP, inflation, and unemployment\u2014are meaningful only when paired with an understanding of their uncertainty.<\/p>\n<ul>\n<li>Quantify uncertainty around baseline projections<\/li>\n<li>Estimate recession and deflation probabilities<\/li>\n<li>Compare upside and downside risks across scenarios<\/li>\n<\/ul>\n<p>These measures support risk-aware decision-making in policy environments<\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2026\/02\/1.-Refining-macroeconomic-fan-charts.png\" alt=\"four line plots showing historical data and blue forecast fan charts for interest rate, output gap, inflation, and GDP growth. \" class=\"wp-image-2643\" width=\"653\" height=\"320\"\/><figcaption class=\"wp-element-caption\"><em>Figure 1: Nonlinear forecast fan charts for key macroeconomic variables. <\/em><\/figcaption><\/figure>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h1>The Challenge: Nonlinear Models and High\u2011Dimensional Simulation<\/h1>\n<p>Nonlinear dynamic stochastic general equilibrium (DSGE) models require extensive simulations to generate statistically reliable confidence bands. Traditional Monte Carlo methods often demand hundreds of thousands of simulations, which becomes impractical for high-dimensional problems involving:<\/p>\n<ul>\n<li>Many shocks<\/li>\n<li>Multiple forecast periods<\/li>\n<li>Large state-space<\/li>\n<\/ul>\n<p>To address these challenges, Tanyeri built an end-to-end workflow in MATLAB that integrates data handling, model solution, and simulation at scale.<\/p>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h1>A MATLAB Based Workflow for Nonlinear Forecasting<\/h1>\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2>Efficient Model Development and Data Preparation<\/h2>\n<p>Tanyeri designed and implemented a nonlinear macroeconomic model directly in MATLAB. All data preparation and transformation steps were automated to run each time the model executes.<\/p>\n<p>A key feature of the model is a nonlinear inflation block that captures asymmetries in how output gaps affect inflation. For example, the model allows positive output gaps to exert a stronger influence on inflation than negative gaps of a similar magnitude.<\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2026\/02\/2.-Refining-macroeconomic-code.png\" alt=\"An equation for \u03c0\u209c as a function of expectations, lagged inflation, output gap, and the real exchange rate, plus bullets explaining the convex output gap term and approximate linearity for small gaps.\" class=\"wp-image-2644\" width=\"647\" height=\"268\"\/><figcaption class=\"wp-element-caption\"><em>Figure 2: Inflation block from the nonlinear DSGE model<\/em><\/figcaption><\/figure>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2>Solving the Model and Establishing the Baseline Forecast<\/h2>\n<p>The workflow includes parameter estimation, filtering noisy data, and generating a baseline forecast inside the MATLAB modeling environment.<\/p>\n<div class=\"is-layout-constrained wp-block-group\">\n<div class=\"wp-block-group__inner-container\">\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blogs.mathworks.com\/finance\/files\/2026\/02\/5.-Refining-macroeconomic-chart-flat-inflation.png\" alt=\"A line plot showing filtered historical inflation (solid line) and the model\u2019s baseline predicted inflation path (dashed line), with a shaded forecast region.\" class=\"wp-image-2646\" width=\"649\" height=\"331\"\/><figcaption class=\"wp-element-caption\"><em>Figure 3: Baseline inflation forecast after parameter estimation and filtering<\/em><\/figcaption><\/figure>\n<\/div>\n<\/div>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2>Advanced Sampling: Latin Hypercube Sampling for Faster Convergence<\/h2>\n<p>To reduce simulation burden, Tanyeri used <strong>Latin hypercube sampling<\/strong>, a structured method that:<\/p>\n<ul>\n<li>Covers high-dimensional shock spaces more evenly<\/li>\n<li>Achieves faster convergence<\/li>\n<li>Requires far fewer draws than standard Monte Carlo methods<\/li>\n<\/ul>\n<p>In his example:<\/p>\n<ul>\n<li>The example used 20 periods and 84 shocks, or 1,680 dimensions.<\/li>\n<li>The workflow reduced simulations from more than 100,000 to about 3,600.<\/li>\n<\/ul>\n<p>This reduction is significant for large macroeconomic workloads.<\/p>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2>Scaling Up with Distributed Computing<\/h2>\n<p>To make the full workflow feasible on tight timelines, Tanyeri deployed Parallel Computing Toolbox with a distributed cluster:<\/p>\n<ul>\n<li>4 servers,<\/li>\n<li>32 cores each<\/li>\n<li>128 total workers<\/li>\n<\/ul>\n<p>In Tanyeri\u2019s workflow, the configuration reduced runtime from months to an overnight process.<\/p>\n<p>In practice, the entire confidence\u2011band computation can be executed through a single function call, with parameters defining the model, number of workers, number of simulations, and output structure.<\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2026\/02\/image-4.png\" alt=\"\" class=\"wp-image-2685\" width=\"718\" height=\"401\"\/><figcaption class=\"wp-element-caption\"><em>Figure 4: MATLAB script snippet launching the nonlinear confidence-bands workflow<\/em><\/figcaption><\/figure>\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h2>Practical Results<\/h2>\n<p>The workflow yields:<\/p>\n<ul>\n<li>Robust confidence bands for key macroeconomic variables<\/li>\n<li>Streamlined and more reliable forecast pipelines<\/li>\n<li>Clear statistics on recession and deflation probabilities\n<\/li>\n<\/ul>\n<p>These results show how economists can use MATLAB to support rigorous, large-scale macroeconomic analysis.<\/p>\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<h1>Learn More<\/h1>\n<ul>\n<li>Explore how to build and analyze <a rel=\"noreferrer noopener\" href=\"https:\/\/www.mathworks.com\/discovery\/dsge-models.html\" target=\"_blank\">DSGE models in MATLAB<\/a><\/li>\n<li>Learn more about <a rel=\"noreferrer noopener\" href=\"https:\/\/www.mathworks.com\/discovery\/time-series-regression.html\" target=\"_blank\">time series regression techniques for macroeconomic forecasting<\/a><\/li>\n<li>Speed up Monte Carlo and DSGE model simulation using <a rel=\"noreferrer noopener\" href=\"https:\/\/.mathworks.com\/products\/parallel-computing.html\" target=\"_blank\">Parallel Computing Toolbox<\/a><\/li>\n<\/ul>\n<div style=\"height:47px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<div class=\"is-layout-flex wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-white-color has-text-color has-background wp-element-button\" href=\"mailto:compfin@mathworks.com\" style=\"background-color:#0076a8\" target=\"_blank\" rel=\"noreferrer noopener\">Contact Us<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2026\/02\/1.-Refining-macroeconomic-fan-charts.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Nonlinear confidence bands help you quantify forecast uncertainty in DSGE models, but they can be slow to compute. At the MathWorks Finance Conference, Kadir Tanyeri (International Monetary Fund)&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/finance\/2026\/02\/26\/refining-macroeconomic-forecasting-with-matlab-techniques\/\">read more >><\/a><\/p>\n","protected":false},"author":233,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,34],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/2639"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/users\/233"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/comments?post=2639"}],"version-history":[{"count":21,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/2639\/revisions"}],"predecessor-version":[{"id":2781,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/2639\/revisions\/2781"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/media?parent=2639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/categories?post=2639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/tags?post=2639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}