Interpreting Historical Data With Model Tomas Motl, Course for Masaryk University, Spring 2021 Interpreting Historical Data With Model Introduction Process in Central Banks What Do They Actually Do? Our Approach Kalman Filter Step 1: Predict Step 2: Update Shocks Application in Macroeconomics Unobservables? Example Maximum Likelihood, Kalman Smoother Numerical example 1) Prediction step: 2) Update step Understanding Kalman Filter Results Expert Judgment Reporting Introduction We are advancing in our quest to produce forecast: 1. Choose the right model framework (DONE) 2. Research the country (DONE) 3. Adjust the model to the country (DONE) 4. Set initial condition for the forecast (TBD) 5. Choose shocks to represent future expected events in the country (TBD) Let's talk about initial condition. Recursive model solution: How do we choose ? (If we do forecast today, how do we choose ) Using only data is not enough, some variables are not observable ( ) Three candidates: 1. Choose the values ourselves by hand. Possible, but difficult - how do you do that? Not practical for us, many variables. 2. Use univariate filters to get all the unobservables we need. Problem: consistency. 3. Use univariate filter: Kalman filter. Note: Initial condition is always under our control. We need to help Kalman filter. Process in Central Banks Forecast process in central banks is long and time-consuming. Example from Angola: Example from Riskbank (I think ?):   Central banks employ large teams (several dozen people) who are mostly concerned with question "What the hell is going on right now?". What do they do? examine individual sectors of the economy using a range of indicators: are retail sales strong? is liquidity tight in the interbank market? which CPI components drive inflation? what is fiscal doing right now? what shocks can we expect in near future? determine a consensus view adjust initial condition (estimated e.g. by Kalman filter) to fit the view CNB Inflation Report, Feb 2011, Table of contents: What Do They Actually Do? Figure of history and shocks here. Use maximum likelihood to find Observable data Kalman filter Model Unobservables + shocks Our Approach We'll skip this step almost entirely. We'll only illustrate how to use Kalman filter and hot to impose judgment (tunes). Kalman Filter We need to expand the set of equations: This specification and naming corresponds to paper "understanding_the_basis_of_the_kalman_filter.pdf" which is in Study Materials. Step 1: Predict Prediction = forecast by the model. Assume we know . What's the best prediction for ? is our estimate of based on information available in time . is covariance matrix (uncertainty) of our prediction . is the covariance matrix of vector . Note that our uncertainty about increases with prediction step. KF gives us the whole joint probability distribution for all variables. Step 2: Update We obtain measurements and update our prediction to get our final estimate . How to combine our prediction and the measurement? Weight them together using the Kalman gain: where is covariance matrix of vector Kalman filter weighs together prediction and information from measurements. The (inverse) weights are and . If we reduce matrices to scalars and we set uncertainty of measurement to zero ( ), we get So we completely disregard predictions. If the measurements are completely precise, model prediction is not important. Shocks Notice that Shocks explain the prediction error, deviation between model prediction and observed data. Shocks are important. They tell us: 1. How the model interprets data (which shocks explain data). 2. Where the model has problem interpreting data (large, autocorrelated shocks). Application in Macroeconomics In macroeconomic models, we usually don't introduce measurement errors and we set . So why do we need Kalman filter? Unobservables? Kalman filter is useful because not all variables are observed. Typically we have much more endogenous variables and shocks than measurements. Matrix is not square, but rectangular. Kalman filter will give us the most likely combination of shocks that explains data. If we know the most likely realization of shocks, we can also calculate unobservables. Example Here and . Let There are infinitely many combinations of that fit the equations above. We need some decision criterion. We specify assumptions about shock distribution: Maximum Likelihood, Kalman Smoother This section is here to give you understanding how Kalman filter works. All of the operations below are embodied by the matrix algebra presented above. The "smallest" combination of shocks is the most likely, so we minimize the expression: In real world applications, we optimize over all shocks and all periods (Kalman smoother). The optimization problem setup is: subject to constraints (model + measurement): Minimizing the above = maximizing likelihood. Integral part of all your fancy estimation methods. Kalman filter/smoother can be viewed as least squares method that finds the minimal shocks needed to explain data. Numerical example Recall our model Here and . Transition matrix Matrix of measurements: Vector of shocks   Uncertainty of initial condition: Covariance matrix of shock vector : Measurements are precise:   Let Initialize variables at their means: 1) Prediction step: Uncertainty:   2) Update step   Recall that We received estimate of all three variables, despite observing only one. Implied values of shocks: Note that the first shock is larger than the second one, exactly in line with our assumptions about their standard errors. Understanding Kalman Filter Results Expert Judgment Kalman is more sophisticated than univariate filters, but it's still pretty dumb. Do not trust it completely. We often add tunes - we pretend we can observe output gap, or output trend, or country risk premium , ... in order to help Kalman filter interpret the data better (= more in line with our understanding). Reporting We need to understand why KF produces the results it produces. We need a way of understanding it's historical interpretation of data: historical interpretation report. This report is useful to check model, understand data, understand where the model fails. We need to understand the economy analytically (your first presentation) before we can properly interpret KF results.