Abstract: This paper shows how to use the Kalman filter (Kalman 1960) to back out the shocks of a dynamic stochastic general equilibrium model. In particular, we use the smoothing algorithm as described in Hamilton (1994) to estimate the shocks of a sticky-prices and sticky-wages model using all the information up to the end of the sample. JEL classification: C63, C68, E37 Key words: dynamic equilibrium economies, the Kalman filter, smoothing 1. Introduction This paper shows how to use the Kalman Filter (Kalman, 1960) to back out the shocks of a dynamic stochastic general equilibrium model. The idea is as follows: First, we write the model in what is called the State-Space Representation. Second, we use the Kalman Filter to write the likelihood function of the observed data and estimated the structural parameters of the model. (1) Third, using the estimate parameters, we estimated the values of the model perturbations during the sample period conditional on all the observed data. (2) This procedure is very useful because it allows us to use a general equilibrium model to make inference about which shocks the economy was facing during any period in the sample based on the full set of collected data. In the first part of the paper we describe how to implement the Kalman filter to estimate structural parameters and smooth the shocks to an abstract linear system. In the second part, we use a sticky price model to show how to use the procedure in practice. 2. The State-Space Representation The first step is to write the model in State-Space form. Let [[eta].sub.t] be a (nx1) vector the observed variables at date t and let [[xi].sub.t] be a (rx1) vector of unobserved variables at date t (this vector is also called the state vector). The State-Space Representation of the system is (3) [[xi].sub.t+1] = F[[xi].sub.t] + [v.sub.t+1] (1) [[eta].sub.t] = H'[[xi].sub.t] + [w.sub.t] (2) where F and H' are matrices of the needed dimensions. Equation (1) is called State Equation, and (2) is the Observed Equation. [v.sub.t] and [w.sub.t] are uncorrelated normally distributed white noise vectors, therefore: [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII] and E ([w.sub.t][v'.sub.[tau]]) = 0 for all t, [tau] 3. Using the Kalman Filter to Write the Likelihood Function of the Model Once the model has be written in State-Space form, the second step is to estimate the structural parameters that define the model. In order to do that, we will need to write the likelihood function of the observed data, [[eta].sup.T] = {[[eta].sub.1], [[eta].sub.2], ..., [[eta].sub.t]}. We will use the Kalman Filter to write the likelihood function l ([[eta].sup.T] |F, H', Q, R) = [[PI].sup.T.sub.t=1] l ([[eta].sub.t]|[[eta].sub.t-1]F, H', Q, R). First, we need to introduce some notation. Let [[xi].sub.t+1|t] = E ([[xi].sub.t+1]|[[eta.sup.t]), be the linear projection of [[xi].sub.t+1] on [[eta].sup.t] and a constant, and let [[eta].sub.t+1|t] = E ([[eta].sub.t+1]|[[eta].sup.t])= H'[[xi].sub.t+1|t] be the linear projection of [[eta].sub.t+1] on [[eta].sup.t] and a constant. Also let [P.sub.t+1|t] = E ([[xi].sub.t+1] - [[xi].sub.t+1|t])([[xi].sub.t+1] - [[xi].sub.t+1|t])', be the mean squared forecasting error when projecting [[xi].sub.t+1], and let [[SIGMA].sub.t+1|t] = E ([[eta].sub.t+1] - [[eta].sub.t+1|t])([[eta].sub.t+1] - [[eta].sub.t+1|t])' = = E (H'[[xi].sub.t+1] + [w.sub.t+1] - H'[[xi].sub.t+1|t])(H'[[xi].sub.t+1] + [w.sub.t+1] - H'[[xi].sub.t+1|t])' = H'[P.sub.t+1|t]H + R be the mean squared forecasting error when projecting [[eta].sub.t+1]. Finally notice that E ([[eta].sub.t+1] - [[eta].sub.t+1|t])([[xi].sub.t+1] - [[xi].sub.t+1|t])' = = E (H'[[xi].sub.t+1] + [w.sub.t+1] - H'[[xi].sub.t+1|t])([[xi]. …