BACK TO SCHOOL Sale is ON! | 20% OFF in ALL Products
As economists, we will be using Octave as a free alternative to MATLAB in order to run Dynare. Dynamic macroeconomic models, in particular Dynamic Stochastic General Equilibrium (DSGE) models, are commonly solved using Dynare, a free software package designed for this purpose, with the particularity that it requires either MATLAB or Octave to operate.
Many universities provide free MATLAB licenses to their students; professionals and enthusiasts, however, will need to purchase one (or resort to an illegal download, which I strongly discourage). Octave is a free alternative and in this tutorial, you will learn how to download it and pair it with Dynare!
Below you will find the download links for Octave and Dynare
For your convenience, I have provided direct download links that I regularly monitor to ensure they point to the latest compatible versions of Octave and Dynare. If you prefer to visit the official Octave website, you can do so by clicking here.
For your convenience, I have provided direct download links that I regularly monitor to ensure they point to the latest compatible versions of Octave and Dynare. If you prefer to visit the official Octave website, you can do so by clicking here.
Once GNU Octave and Dynare are installed, a few simple commands are all you need to prepare your environment and start running Dynare models. The steps below show you how to add Dynare to Octave's path, set your working directory, and make sure everything is properly configured before running your first .mod file. These basic setup commands are useful whenever you start a new Dynare project or need to configure Octave on a new computer.
The first step is to tell Octave where to find Dynare's commands and functions. In Octave's Command Window, copy and paste the following command. In this tutorial, we are using Dynare version 7.2, so the path below points to the 7.2 folder. If you installed a different version of Dynare, make sure to replace 7.2 with the version you have installed.
addpath('C:/dynare/7.2/matlab')
This adds Dynare's MATLAB/Octave functions to Octave's search path, allowing you to run Dynare directly from the Command Window.
Before running our models, we need a dedicated folder where we can store our Dynare models, scripts, and results. Keeping these files separate from Dynare's installation folder helps us avoid mixing our own work with Dynare's main files.
In this tutorial, we create a folder called econtutorials inside C:/dynare. You can create it manually using your computer's File Explorer, or directly from Octave with:
mkdir('C:/dynare/econtutorials')
The mkdir command stands for make directory and creates a new folder at the specified location.
Once the folder has been created, we need to tell Octave to use it as our working directory. This is the folder where Octave will look for our model files and where files generated by Dynare will be saved.
Run:
cd('C:/dynare/econtutorials')
The cd command means change directory. It moves Octave from its current folder to the directory we specify.
You can confirm that Octave is now working in the correct folder with:
pwd
The pwd command means print working directory and displays the folder Octave is currently using.
Once Dynare has been added to Octave's path and our working directory is correctly set, we are ready to run a Dynare model.
In this tutorial, our model file is called rbc_damico.mod. To run it, simply enter:
dynare rbc_damico.mod
The dynare command tells Octave to pass the .mod file to Dynare for processing. Dynare will then read the model, solve it, and generate the corresponding output and result files in the working directory.
GNU Octave is a free, open-source programming language designed for numerical and scientific computing. Its syntax is largely compatible with MATLAB, making it a popular alternative for students, researchers, economists, engineers, and anyone working with mathematical models or numerical analysis.
Octave can be used for tasks such as matrix operations, statistical analysis, numerical optimization, solving systems of equations, differential equations, simulations, and data analysis. It can be used interactively through its command line or to run complete scripts and programs.
One of Octave's main advantages is that it is free to download and use, while offering many of the numerical computing capabilities commonly associated with MATLAB. It can also be extended through user-written functions and additional packages.
For economists in particular, Octave can be useful for macroeconomic modeling, simulations, econometrics, and computational economics. It can also be used with software such as Dynare to solve and simulate DSGE and other dynamic economic models.
Are you looking for a list with all the different Octave versions available to download? Click here.
Below you can find the different DSGE models I have taught over in my tutorials and that are compatible with Dynare.
Full RBC course in Matlab dynare
This course is ideal for those who are new to MATLAB and Dynare and want to gain hands-on, practical experience. You will start by learning how to set up and use the software, then build and solve a classic RBC model while deriving each of its key equations and solutions step by step.
Finally, we bring real-world data into the model and introduce a unique bonus feature: oil as an input in the production function. You will work with real oil price data and incorporate oil supply and demand equations into the model.
Upon completion, you will receive a certificate that you can share with your professional network.
RBC Model with Government and Learning-by-Doing à la Arrow
This package contains the code for two extensions of the classic RBC model. The first incorporates a government sector with taxation and transfers, while the second introduces learning-by-doing spillovers à la Arrow.
New Keynesian Model: The canonical three equations model
This package contains the code for the standard three-equation New Keynesian model. The framework includes the dynamic IS curve, the New Keynesian Phillips curve, and a Taylor rule for monetary policy, allowing the analysis of how demand, supply, and monetary policy shocks affect the economy.