JuliaCon 2020 (times are in UTC)

JuliaCon 2020 (times are in UTC)

State Space Modeling for Macroeconomics with StateSpaceEcon
2020-07-30 , Green Track

We will show how StateSpaceEcon can be used for state space modeling in macroeconomics in Julia. This package can solve discrete-time systems of linear and non-linear equations that contain expectations of future values of the variables. The shocks to the system can be anticipated or unanticipated. This package can also find the steady state of the system and diagnose which variables are left undetermined. In addition, we will cover the Julia package TSeries to work with discrete time series.


We will give an overview of what the Julia package StateSpaceEcon can do and how it works internally.

Macroeconomics typically deals with discrete-time systems of non-linear equations that include expectations of future values of the variables. One way to solve for these expectations is the “rational expectations” hypothesis which posits that expectations should be consistent with the whole system.

The package StateSpaceEcon solves these kinds of systems using a stacked-time algorithm. This algorithm builds one large system of equations over all time periods and solves it using a root-finding algorithm such as Newton-Raphson. This approach works very well for large discrete-time systems of non-linear equations simulated with anticipated shocks. When shocks are anticipated, the expectation about the future values of the variables and their realisations are equal.

Besides, the StateSpaceEcon package offer functionalities that facilitate working with state space systems in the context of macroeconomic policy analysis.
1. The package dependency TimeSeries supports time series at low frequencies (e.g. integer, monthly, quarterly and yearly). Vectorized operations, indexing and assignments greatly facilitate data manipulations.
2. A plan object allows to perfectly control which variables and shocks are endogenous (i.e. determined by the system) or exogenous (imposed on the system externally), which might change from one time period to the next.
3. On top of anticipated shocks, the package can handle unanticipated shocks. In this case, the expectations and their realizations will differ.
4. The rational expectations solver computes the Jacobian of the system using automatic differentiation. It uses sparse matrices throughout in order to handle the very large, but very sparse, Jacobian resulting from the stacked-time algorithm.
5. The steady state of the system can be computed and analysed using QR decomposition to report states that are left undetermined. Functionalities allow for adding steady state equations and assumptions, in order to close the steady state system.
6. Finally, the package StateSpaceEcon can linearize the system around the steady state or any other solution and use the linearized system for simulations.

Nicholas Labelle St-Pierre is a Principal Economist in the Projection Division of the Canadian Economic Analysis Department at the Bank of Canada. His research interests include macroeconomics and computational economics. Nicholas holds an MSc in Economics from the University of Quebec in Montreal (UQAM).

Boyan is a Senior Data Scientist at the Bank of Canada in the Digital Economy and Advanced Analytics division. He is interested in scientific computing. His PhD is in Applied Mathematics from the University of Alberta in Edmonton, Alberta, Canada.

Projection Analyst, Bank of Canada.