HetLearn Toolbox
HetLearn Toolbox
A MATLAB toolbox for forecasts and policy scenarios in dynamic stochastic general equilibrium (DSGE) models where not everyone has rational expectations.
What it does
hetlearn is built on the IRIS Toolbox. For the forward-looking variables you choose, expectations are a weighted mix of the forecasts of rational-expectations agents and adaptive learners. Learners forecast from a simple perceived law of motion and update it by recursive least squares. The shares of the two groups switch each quarter with their recent forecast errors, following Ozden (2025, International Journal of Central Banking).
You bring a linear IRIS model file and a database. The toolbox writes the heterogeneous-expectations version of the model, learns beliefs and shares over the history, and runs your scenario forward one quarter at a time. The documentation walks through worked examples on the Smets and Wouters (2007) model with US data. The code is open source under the MIT license.