The Econometrics of Uncertainty Shocks Jesús Fernández-Villaverde University of Pennsylvania March 7, 2016 Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 1 / 69 Several challenges Several challenges How do we document the presence of time-varying uncertainty? How do we distinguish time-variation in the data and in expectations? Forecaster disagreement? How much of the uncertainty is exogenous or endogenous? How do we take DSGE models with time-varying uncertainty to the data? 1 Likelihood function. 2 Method of moments. Because of time limitations, I will focus on the …rst and last challenges. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 2 / 69 Documenting time-varying uncertainty. Interest rates Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 3 / 69 Documenting time-varying uncertainty. A real life example Remember our decomposition of interest rates: rt = |{z} r + mean εtb,t and εr ,t follow: + εtb,t |{z} T-Bill shocks εr ,t |{z} Spread shocks εtb,t = ρtb εtb,t 1 + e σtb,t utb,t , utb,t εr ,t = ρr εr ,t 1 + e σr ,t ur ,t , ur ,t N (0, 1) N (0, 1) σtb,t and σr ,t follow: σtb,t = 1 ρσtb σtb + ρσtb σtb,t σr ,t = 1 Jesús Fernández-Villaverde (PENN) ρσr σr + ρσr σr ,t 1 1 Econometrics + η tb uσtb ,t , uσtb ,t + η r uσr ,t , uσr ,t N (0, 1) N (0, 1) March 7, 2016 4 / 69 Documenting time-varying uncertainty. Stochastic volatility Remember, as well, that we postulated a general process for stochastic volatility: xt = ρxt 1 + σ t εt , εt N (0, 1). and log σt = (1 ρσ ) log σ + ρσ log σt 1 + 1 ρ2σ 1 2 ηut , ut N (0, 1). We discussed this was a concrete example of a richer class of speci…cations. Main point: non-linear structure. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 5 / 69 Documenting time-varying uncertainty. State space representation I De…ne: xt 1 σt St = Then, we have a transition equation: xt σ t +1 xt σt =f , εt ut + 1 ;γ where the …rst row of f ( ) is: xt = ρxt 1 + σ t εt and the second is log σt +1 = (1 ρσ ) log σ + ρσ log σt + 1 ρ2σ 1 2 ηut +1 The vector of parameters: γ = (ρ, ρσ , log σ, η ) Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 6 / 69 Documenting time-varying uncertainty. State space representation II In more compact notation: St = f ( St 1 , Wt ; γ ) We also have a trivial measurement equation: Yt = 1 0 xt σ t +1 In more general notation: Yt = g (St , Vt ; γ) Note Markov structure. Note also how we can easily accommodate more general cases. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 7 / 69 Documenting time-varying uncertainty. Shocks fWt g and fVt g are independent of each other. fWt g is known as process noise and fVt g as measurement noise. Wt and Vt have zero mean. No assumptions on the distribution beyond that. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 8 / 69 Documenting time-varying uncertainty. Conditional densities From St = f (St 1 , Wt ; γ ) , we can compute p (St jSt 1 ; γ ). From Yt = g (St , Vt ; γ), we can compute p (Yt jSt ; γ) . From St = f (St 1 , Wt ; γ ) and Yt = g (St , Vt ; γ), we have: Yt = g ( f ( St 1 , Wt ; γ ) , Vt ; γ ) and hence we can compute p (Yt jSt Jesús Fernández-Villaverde (PENN) Econometrics 1 ; γ ). March 7, 2016 9 / 69 Filtering Filtering, smoothing, and forecasting Filtering: we are concerned with what we have learned up to current observation. Smoothing: we are concerned with what we learn with the full sample. Forecasting: we are concerned with future realizations. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 10 / 69 Filtering Goal of …ltering I Compute conditional densities: p St jy t 1; γ and p (St jy t ; γ) . Why? 1 It allows probability statements regarding the situation of the system. 2 Compute conditional moments: mean, st jt and st jt 1 , and variances Pt jt and Pt jt 1 . 3 Other functions of the states. Examples of interest. Theoretical point: do the conditional densities exist? Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 11 / 69 Filtering Goals of …ltering II Evaluate the likelihood function of the observables y T at parameter values γ: p yT ; γ Given the Markov structure of our state space representation: T p y T ; γ = p (y1 jγ) ∏ p yt jy t 1 ;γ t =2 Then: T p y ;γ = Z T p (y1 js1 ; γ) dS1 ∏ t =2 Z p (yt jSt ; γ) p St jy t 1 ; γ dSt T Hence, knowledge of p St jy t 1 ; γ t =1 and p (S1 ; γ) allow the evaluation of the likelihood of the model. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 12 / 69 Filtering Two fundamental tools 1 Chapman-Kolmogorov equation: p St j y t 2 1 ;γ = Z p ( St j St 1 ; γ) p St 1 jy t 1 ; γ dSt 1 Bayes’theorem: p St j y t ; γ = p (yt jSt ; γ) p St jy t p (yt jy t 1 ; γ) 1; γ Z p (yt jSt ; γ) p St jy t 1 where: p yt jy t Jesús Fernández-Villaverde (PENN) 1 ;γ = Econometrics ; γ dSt March 7, 2016 13 / 69 Filtering Interpretation All …ltering problems have two steps: prediction and update. 1 Chapman-Kolmogorov equation is one-step ahead predictor. 2 Bayes’theorem updates the conditional density of states given the new observation. We can think of those two equations as operators that map measures into measures. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 14 / 69 Filtering Recursion for conditional distribution Combining the Chapman-Kolmogorov and the Bayes’theorem: R R R p St j y t ; γ = p (St jSt 1 ; γ) p St 1 jy t 1 ; γ dSt 1 p (yt jSt ; γ) p (St jSt 1 ; γ) p (St 1 jy t 1 ; γ) dSt 1 p (yt jSt ; γ) dSt To initiate that recursion, we only need a value for s0 or p (S0 ; γ). Applying the Chapman-Kolmogorov equation once more, we get T p St jy t 1 ; γ t =1 to evaluate the likelihood function. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 15 / 69 Filtering Initial conditions From previous discussion, we know that we need a value for s1 or p ( S1 ; γ ) . Stationary models: ergodic distribution. Non-stationary models: more complicated. Importance of transformations. Forgetting conditions. Non-contraction properties of the Bayes operator. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 16 / 69 Filtering Smoothing We are interested on the distribution of the state conditional on all the observations, on p St jy T ; γ and p yt jy T ; γ . We compute: p St j y T ; γ = p St j y t ; γ Z p St + 1 j y T ; γ p ( St + 1 j St ; γ ) dSt +1 p ( St + 1 j y t ; γ ) a backward recursion that we initialize with p ST jy T ; γ , fp (St jy t ; γ)gTt=1 and p St jy t Jesús Fernández-Villaverde (PENN) 1; γ Econometrics T t =1 we obtained from …ltering. March 7, 2016 17 / 69 Filtering Forecasting We apply the Chapman-Kolmogorov equation recursively, we can get p (St +j jy t ; γ) , j 1. Integrating recursively: p yl +1 jy l ; γ = Z p (yl +1 jSl +1 ; γ) p Sl +1 jy l ; γ dSl +1 from t + 1 to t + j, we get p yt +j jy T ; γ . Clearly smoothing and forecasting require to solve the …ltering problem …rst! Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 18 / 69 Filtering Problem of …ltering We have the recursion R R R p St j y t ; γ = p (St jSt 1 ; γ) p St 1 jy t 1 ; γ dSt 1 p (yt jSt ; γ) p (St jSt 1 ; γ) p (St 1 jy t 1 ; γ) dSt 1 p (yt jSt ; γ) dSt A lot of complicated and high dimensional integrals (plus the one involved in the likelihood). In general, we do not have closed form solution for them. Translate, spread, and deform (TSD) the conditional densities in ways that impossibilities to …t them within any known parametric family. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 19 / 69 Filtering Exception There is one exception: linear and Gaussian case. Why? Because if the system is linear and Gaussian, all the conditional probabilities are also Gaussian. Linear and Gaussian state spaces models translate and spread the conditional distributions, but they do not deform them. For Gaussian distributions, we only need to track mean and variance (su¢ cient statistics). Kalman …lter accomplishes this goal e¢ ciently. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 20 / 69 Nonlinear Filtering Nonlinear …ltering Di¤erent approaches. Deterministic …ltering: 1 Kalman family. 2 Grid-based …ltering. Simulation …ltering: 1 McMc. 2 Particle …ltering. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 21 / 69 Nonlinear Filtering Particle …ltering I Remember, 1 Transition equation: St = f (St 1 , Wt ; γ) 2 Measurement equation: Yt = g (St , Vt ; γ) Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 22 / 69 Nonlinear Filtering Particle …ltering II Some Assumptions: 1 We can partition fWt g into two independent sequences fW1,t g and fW2,t g, s.t. Wt = (W1,t , W2,t ) and dim (W2,t ) + dim (Vt ) dim (Yt ). 2 We can always evaluate the conditional densities p yt jW1t , y t 1 , S0 ; γ . 3 The model assigns positive probability to the data. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 23 / 69 Nonlinear Filtering Rewriting the likelihood function Evaluate the likelihood function of the a sequence of realizations of the observable y T at a particular parameter value γ: p yT ; γ We factorize it as (careful with initial condition!): p yT ; γ = T ∏p t =1 T = ∏ t =1 Z Z p yt jW1t , y t Jesús Fernández-Villaverde (PENN) 1 yt jy t 1 ;γ , S0 ; γ p W1t , S0 jy t Econometrics 1 ; γ dW1t dS0 March 7, 2016 24 / 69 Nonlinear Filtering A law of large numbers If n t jt 1,i s0 t jt 1,i , w1 p W1t , S0 jy t 1; γ oN T N i.i.d. draws from i =1 T , t =1 then: T N p yT ; γ ' t =1 1 ∏N t =1 ∑p i =1 t jt 1,i yt jw1 , yt 1 t jt 1,i , s0 ;γ The problem of evaluating the likelihood is equivalent to the problem of drawing from p W1t , S0 jy t Jesús Fernández-Villaverde (PENN) 1 Econometrics ;γ T t =1 March 7, 2016 25 / 69 Nonlinear Filtering Introducing particles I n s0t 1,i , w1t 1,i oN i =1 Each s0t 1,i , w1t particles. n t jt 1,i s0 1,i t jt 1,i , w1 Jesús Fernández-Villaverde (PENN) N i.i.d. draws from p W1t is a particle and oN i =1 n s0t 1,i , w1t 1 , S0 j y t 1,i oN i =1 N i.i.d. draws from p W1t , S0 jy t Econometrics 1; γ . a swarm of 1; γ . March 7, 2016 26 / 69 Nonlinear Filtering Introducing particles II t jt 1,i t jt 1,i Each s0 , w1 is a proposed particle and n o t jt 1,i t jt 1,i N s0 , w1 a swarm of proposed particles. i =1 Weights: qti = Jesús Fernández-Villaverde (PENN) t jt 1,i p yt jw1 , yt t jt 1,i ∑N i =1 p yt jw1 Econometrics 1 , s t jt 1,i ; γ 0 , yt 1 , s t jt 1,i ; γ 0 March 7, 2016 27 / 69 Nonlinear Filtering A proposition Theorem Let e s0i , w e1i N i =1 be a draw with replacement from and probabilities qti . Then Importance: 1 It shows how a draw can be used to draw 2 n N e s0i , w e1i i =1 n n t jt 1,i s0 s0t,i , w1t,i oN t jt 1,i s0 is a draw from t jt 1,i , w1 oN s0t,i , w1t,i n i =1 oN i =1 t jt 1,i , w1 oN i =1 t t p (W1 , S0 jy ; γ). from p W1t , S0 jy t 1 ; γ from p (W1t , S0 jy t ; γ). from p (W1t , S0 jy t ; γ) we can use n o t +1 jt,i t +1 jt,i N p (W1,t +1 ; γ) to get a draw s0 , w1 and iterate the i =1 procedure. With a draw Jesús Fernández-Villaverde (PENN) i =1 Econometrics March 7, 2016 28 / 69 Nonlinear Filtering Algorithm Step 0, Initialization: Set t 1 and set p W1t 1 , S0 jy t 1 ; γ = p (S0 ; γ). n t jt Step 1, Prediction: Sample N values s0 the density p W1t , S0 jy t 1; γ 1,i t jt 1,i , w1 oN from i =1 = p (W1,t ; γ) p W1t 1 , S0 jy t 1 ; γ t jt 1,i t jt 1,i each draw s0 , w1 the . Step 2, Weighting: Assign to weight qti . n oN Step 3, Sampling: Draw s0t,i , w1t,i with rep. from i =1 n oN N t jt 1,i t jt 1,i s0 , w1 with probabilities qti i =1 . If t < T set i =1 t t + 1 and go to step 1. Otherwise go to step 4. T n o t jt 1,i t jt 1,i N s0 Step 4, Likelihood: Use , w1 to compute: i =1 p yT ; γ ' Jesús Fernández-Villaverde (PENN) T 1 N ∏N ∑p t =1 i =1 t jt 1,i yt jw1 Econometrics , yt t =1 1 t jt 1,i , s0 ;γ March 7, 2016 29 / 69 Nonlinear Filtering Evaluating a Particle …lter We just saw a plain vanilla particle …lter. How well does it work in real life? Is it feasible to implement in large models? Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 30 / 69 Nonlinear Filtering Why did we resample? We could have not resampled and just used the weights as you would have done in importance sampling (this is known as sequential importance sampling ). Most weights go to zero. But resampling impoverish the swarm. Eventually, this becomes a problem. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 31 / 69 Nonlinear Filtering Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 32 / 69 Nonlinear Filtering Why did we resample? E¤ective Sample Size: ESSt = h 1 t jt 1,i ∑N i =1 p yt jw1 Alternatives: , yt 1 , s t jt 1,i ; γ 0 i2 1 Strati…ed resampling (Kitagawa, 1996): optimal in terms of variance. 2 Adaptive resampling. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 33 / 69 Nonlinear Filtering Simpler notation To simplify notation: 1 Let me write the conditional distributions in terms of the current state (instead of the innovations and the initial state). 2 Let me forget about the special notation required for period 1 (y t 1 = ?). Then, the evaluation of the likelihood is just: p yT ; γ = T ∏ t =1 Thus, we are looking for p St j y t 1; γ Jesús Fernández-Villaverde (PENN) T t =1 . Z Z n p yt jS t ; γ p St jy t s t jt 1,i oN Econometrics i =1 1 ; γ dSt T N i.i.d. draws from t =1 March 7, 2016 34 / 69 Nonlinear Filtering Improving our Particle …lter I Remember what we did: 1 2 We draw from s t jt 1,i p St js t 1,i ; γ We resample them with: qti = p yt js t jt 1,i , y t 1 ; γ t jt 1,i , y t 1 ; γ ∑N i = 1 p yt j s But, what if I can draw instead from s t jt 1,i q St j s t 1,i , y t; γ ? Intuition. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 35 / 69 Nonlinear Filtering Improving our Particle …lter II New weights: p yt js t jt qti = 1,i , y t 1 ; γ t jt ∑N i =1 p yt js p (S t js t 1,i ;γ) q (S t js t 1,i ,yt ;γ) 1,i , y t 1 ; γ p (S t js t 1,i ;γ) q (S t js t 1,i ,yt ;γ) Clearly, if q St j s t 1,i , y t ; γ = p St j s t 1,i ;γ we get back our basic Particle Filter. How do we create the proposal q St js t 1 Linearized model. 2 Unscented Kalman …lter. 3 Information from the problem. Jesús Fernández-Villaverde (PENN) Econometrics 1,i , y ; γ t ? March 7, 2016 36 / 69 Nonlinear Filtering Improving our Particle …lter III Auxiliary Particle Filter: Pitt and Shephard (1999). Imagine we can compute either p yt +1 js t,i or p e yt +1 js t,i Then: qti = p e yt +1 js t,i p yt js t jt 1,i , y t 1 ; γ e (yt +1 js t,i ) p yt js t jt ∑N i =1 p p (S t js t 1,i ;γ) q (S t js t 1,i ,yt ;γ) 1,i , y t 1 ; γ p (S t js t 1,i ;γ) q (S t js t 1,i ,yt ;γ) Auxiliary Particle Filter tends to work well when we have fat tail... ...but it can temperamental. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 37 / 69 Nonlinear Filtering Improving our Particle …lter IV Resample-Move. Blocking. Many others. A Tutorial on Particle Filtering and Smoothing: Fifteen years later, by Doucet and Johansen (2012) Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 38 / 69 Nonlinear Filtering Nesting it in a McMc Fernández-Villaverde and Rubio Ramírez (2007) and Flury and Shepard (2008). You nest the Particle …lter inside an otherwise standard McMc. Two caveats: 1 Lack of di¤erentiability of the Particle …lter. 2 Random numbers constant to avoid chatter and to be able to swap operators. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 39 / 69 Nonlinear Filtering Parallel programming Why? Divide and conquer. Shared and distributed memory. Main approaches: 1 OpenMP. 2 MPI. 3 GPU programming: CUDA and OpenCL. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 40 / 69 Nonlinear Filtering Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 41 / 69 Nonlinear Filtering Tools In Matlab: parallel toolboox. In R: package parallel. In Julia: built-in procedures. In Mathematica: parallel computing tools. GPUs: ArrayFire. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 42 / 69 Nonlinear Filtering Parallel Particle …lter Simplest strategy: generating and evaluating draws. A temptation: multiple swarms. How to nest with a McMc? Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 43 / 69 Nonlinear Filtering A problem Basic Random Walk Metropolis Hastings is di¢ cult to parallelize. Why? Proposal draw θ i +1 depends on θ i . Inherently serial procedure. Assume, instead, that we have N processors. Possible solutions: 1 Run parallel chains. 2 Independence sampling. 3 Pre-fetching. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 44 / 69 Nonlinear Filtering Multiple chains We run N chains, one in each processor. We merge them at the end. It goes against the principle of one, large chain. But it may works well when the burn-in period is small. If the burn-in is large or the chain has subtle convergence issues, it results in waste of time and bad performance. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 45 / 69 Nonlinear Filtering Independence sampling j We generate N proposals e θ i +1 from an independent distribution. We evaluate the posterior from each proposal in a di¤erent processor. We do N Metropolis steps with each proposal. Advantage: extremely simple to code, nearly linear speed up. Disadvantage: independence sampling is very ine¢ cient. Solution)design a better proposal density. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 46 / 69 Nonlinear Filtering Prefetching I Proposed by Brockwell (2006). Idea: we can compute the relevant posteriors several periods in advance. Set superindex 1 for rejection and 2 for acceptance. Advantage: if we reject a draw, we have already evaluated the next step. Disadvantage: wasteful. More generally, you can show that the speed up will converge only to log2 N. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 47 / 69 Nonlinear Filtering Prefetching II 1 2 3 4 5 6 Assume we are at θ i . n 1 2 θ i +1 = θ i , e We draw 2 paths for iteration i + 1, e θ i +1 We i +2 n 11draw 41 paths12 for iteration 1 21 2 22 e θ i +2 = e θ i +1 , e θ i +2 g e θ i +1 , e θ i +2 = e θ i +1 , e θ i +2 o g (θ i ) . 2 g e θ i +1 We iterate h steps, until we have N = 2h possible sequences. 1,...,1 2,...,2 We evaluate each of the posteriors p e θ i +h , ..., p e θ i +h of the N processors. o . in each We do a MH in each step of the path using the previous posteriors (note that any intermediate posterior is the same as the corresponding …nal draw where all the following children are “rejections”). Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 48 / 69 Nonlinear Filtering A simpler prefetching algorithm I Algorithm for N processors, where N is small. Given θ i : 1 2 We draw N n o e θ i +1,1 , ..., e θ i +1,N and we evaluate the posteriors p e θ i +1,1 , ..., p e θ i +1,N . We evaluate the …rst proposal, e θ i +1,1 : 1 2 3 If accepted, we disregard θ i +1,2 , ..., θ i +1,2 . If rejected, we make θ i +1 = θ i and e θ i +2,1 = e θ i +1,2 is our new proposal for i + 2. We continue down the list of N proposals until we accept one. Advantage: if we reject a draw, we have already evaluated the next step. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 49 / 69 Nonlinear Filtering A simpler prefetching algorithm II Imagine we have a PC with N = 4 processors. Well gauged acceptance for a normal SV model me …x it to 25% for simplicity. 20% 25%. Let Then: 1 P (accepting 1st draw ) = 0.25. We advance 1 step. 2 P (accepting 2nd draw ) = 0.75 0.25. We advance 2 steps. 3 P (accepting 3tr draw ) = 0.752 0.25. We advance 3 steps. 4 P (accepting 4th draw ) = 0.753 0.25. We advance 4 steps. 5 P (not accepting any draw ) = 0.75 4 . We advance 4 steps. Therefore, expected numbers of steps advanced in the chain: 1 0.25 + 2 0.75 0.25 + 3 0.75 Jesús Fernández-Villaverde (PENN) Econometrics 2 0.25 + 4 0.753 = 2.7344 March 7, 2016 50 / 69 Taking DSGE-SV Models to the Data First-order approximation Remember that the …rst-order approximation of a canonical RBC model without persistence in productivity shocks: kbt +1 = a1 kbt + a2 εt , εt Then: kbt +1 = a1 a1 kbt = a12 kbt 1 1 + a2 ε t + a1 a2 ε t Since a1 < 1 and assuming kb0 = 0 kbt +1 = a2 N (0, 1) 1 + a2 ε t + a2 ε t 1 t ∑ a1j εt j j =0 which is a well-understood MA system. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 51 / 69 Taking DSGE-SV Models to the Data Higher-order approximations Second-order approximation: kbt +1 = a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt , εt N (0, 1) Then: kbt +1 = a0 + a1 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt + a2 εt +a3 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt 2 + a4 ε2t +a5 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt εt We have terms in kbt3 and kbt4 . Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 52 / 69 Taking DSGE-SV Models to the Data Problem For a large realization of εt , the terms in kbt3 and kbt4 make the system explode. This will happen as soon as we have a large simulation) no unconditional moments would exist based on this approximation. This is true even when the corresponding linear approximation is stable. Then: 1 How do you calibrate? (translation, spread, and deformation). 2 How do you implement GMM or SMM? 3 Asymptotics? Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 53 / 69 Taking DSGE-SV Models to the Data A solution For second-order approximations, Kim et al. (2008): pruning. Idea: kbt +1 = a0 + a1 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt + a2 εt +a3 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt 2 + a4 ε2t +a5 a0 + a1 kbt + a2 εt + a3 kbt2 + a4 ε2t + a5 kbt εt εt We omit terms raised to powers higher than 2. Pruned approximation does not explode. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 54 / 69 Taking DSGE-SV Models to the Data What do we do? Build a pruned state-space system. Apply pruning to an approximation of any arbitrary order. Prove that …rst and second unconditional moments exist. Closed-form expressions for …rst and second unconditional moments and IRFs. Conditions for the existence of some higher unconditional moments, such as skewness and kurtosis. Apply to a New Keynesian model with EZ preferences. Software available for distribution. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 55 / 69 Taking DSGE-SV Models to the Data Practical consequences 1 GMM and IRF-matching can be implemented without simulation. 2 First and second unconditional moments or IRFs can be computed in a trivial amount of time for medium-sized DSGE models approximated up to third-order. 3 Use the unconditional moment conditions in optimal GMM estimation to build a limited information likelihood function for Bayesian inference (Kim, 2002). 4 Foundation for indirect inference as in Smith (1993) and SMM as in Du¢ e and Singleton (1993). 5 Calibration. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 56 / 69 State-Space Representations Dynamic models and state-space representations Dynamic model: xt +1 = h (xt , σ) + σηet +1 , et +1 IID (0, I) yt = g (xt , σ ) Comparison with our previous structure. Again, general framework (augmented state vector). Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 57 / 69 State-Space Representations The state-space system I Perturbation methods approximate h (xt , σ) and g (xt , σ) with Taylor-series expansions around xss = σ = 0. A …rst-order approximated state-space system replaces g (xt , σ) and h (xt , σ) with gx xt and hx xt . If 8 mod (eig (hx )) < 1, the approximation ‡uctuates around the steady state (also its mean value). Thus, easy to calibrate the model based on …rst and second moments or to estimate it using Bayesian methods, MLE, GMM, SMM, etc. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 58 / 69 State-Space Representations The state-space system II We can replace g (xt , σ) and h (xt , σ) with their higher-order Taylor-series expansions. However, the approximated state-space system cannot, in general, be shown to have any …nite moments. Also, it often displays explosive dynamics. This occurs even with simple versions of the New Keynesian model. Hence, it is di¢ cult to use the approximated state-space system to calibrate or to estimate the parameters of the model. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 59 / 69 State-Space Representations The pruning method: second-order approximation I Partition states: h xft 0 (xst )0 i Original state-space representation: 1 (2 ) xt +1 = hx xft + xst + Hxx 2 (2 ) yt xft + xst 1 (2 ) (2 ) = gx xt + Gxx xt 2 Jesús Fernández-Villaverde (PENN) Econometrics xft + xst (2 ) xt 1 + hσσ σ2 + σηet +1 2 1 + gσσ σ2 2 March 7, 2016 60 / 69 State-Space Representations The pruning method: second-order approximation II New state-space representation: xft +1 = hx xft + σηet +1 1 xst +1 = hx xst + Hxx xft xft + 2 ytf = gx xft 1 yts = gx xft + xst + Gxx xft xft 2 1 hσσ σ2 2 1 + gσσ σ2 2 All variables are second-order polynomials of the innovations. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 61 / 69 State-Space Representations The pruning method: third-order approximation I Partition states: h xft 0 (xst )0 xrd t 0 i Original state-space representation: (3 ) 1 1 (3 ) (3 ) (3 ) (3 ) + Hxx xt xt + Hxxx xt xt 2 6 1 3 1 (3 ) + hσσ σ2 + hσσx σ2 xt + hσσσ σ3 + σηet +1 2 6 6 1 1 (3 ) (3 ) (3 ) (3 ) (3 ) = gx xt + Gxx xt xt + Gxxx xt xt 2 6 3 1 1 (3 ) + gσσ σ2 + gσσx σ2 xt + gσσσ σ3 2 6 6 (3 ) xt +1 = hx xt (3 ) yt Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 (3 ) xt (3 ) xt 62 / 69 State-Space Representations The pruning method: third-order approximation II New state-space representation: xrd t +1 ytrd Second-order pruned state-space representation+ 1 f = hx xrd xst + Hxxx xft xft xf t + Hxx xt 6 3 1 2 f 3 + hσσx σ xt + hσσσ σ 6 6 1 = gx xft + xst + xrd + Gxx xft xft + 2 xft xst t 2 1 1 3 1 f f f + Gxxx xt xt xt + gσσ σ2 + gσσx σ2 xft + gσσσ σ3 6 2 6 6 All variables are third-order polynomials of the innovations. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 63 / 69 State-Space Representations Higher-order approximations We can generalize previous steps: 1 Decompose the state variables into …rst-, second-, ... , and kth-order e¤ects. 2 Set up laws of motions for the state variables capturing only …rst-, second-, ... , and kth-order e¤ects. 3 Construct the expression for control variables by preserving only e¤ects up to kth-order. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 64 / 69 State-Space Representations Statistical properties: second-order approximation I Theorem If 8 mod (eig (hx )) < 1 and et +1 has …nite fourth moments, the pruned state-space system has …nite …rst and second moments. Theorem If 8 mod (eig (hx )) < 1 and et +1 has …nite sixth and eighth moments, the pruned state-space system has …nite third and fourth moments. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 65 / 69 State-Space Representations Statistical properties: second-order approximation II We introduce the vectors h (2 ) zt xft 2 (2 ) ξ t +1 First moment: 0 6 e t +1 6 4 (xst )0 hx ) 1 Jesús Fernández-Villaverde (PENN) xft e t +1 0 i0 3 et +1 vec (Ine ) 7 7 5 et +1 xft f xt et +1 h i h i (2 ) E xt = E xft + E [xst ] | {z } | {z } =0 E [xst ] = (I xft 1 Hxx (I 2 6 =0 1 hx ) 1 (ση ση) vec (Ine ) + hσσ σ2 2 h i (2 ) E [yts ] = C(2 ) E zt + d(2 ) hx Econometrics March 7, 2016 66 / 69 State-Space Representations Statistical properties: second-order approximation III Second moment: (2 ) V zt (2 ) = A(2 ) V zt (2 ) A(2 ) l (2 ) 0 (2 ) + B(2 ) V ξ t B(2 ) 0 (2 ) Cov zt +l , zt = A(2 ) V zt for l = 1, 2, 3, ... h i (2 ) V xt = V xft + V (xst ) + Cov xft , xst + Cov xst , xft V [yts ] = C(2 ) V [zt ] C(2 ) (2 ) (2 ) Cov (yts , yts +l ) = C(2 ) Cov zt +l , zt (2 ) where we solve for V zt Lyapunov equations. Jesús Fernández-Villaverde (PENN) C(2 ) 0 0 for l = 1, 2, 3, ... by standard methods for discrete Econometrics March 7, 2016 67 / 69 State-Space Representations Statistical properties: second-order approximation IV Generalized impulse response function (GIRF): Koop et al. (1996) GIRFvar (l, ν, wt ) = E [vart +l jwt , et +1 = ν] E [vart +l jwt ] Importance in models with volatility shocks. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 68 / 69 State-Space Representations Statistical properties: third-order approximation Theorem If 8 mod (eig (hx )) < 1 and et +1 has …nite sixth moments, the pruned state-space system has …nite …rst and second moments. Theorem If 8 mod (eig (hx )) < 1 and et +1 has …nite ninth and twelfth moments, the pruned state-space system has …nite third and fourth moments. Similar (but long!!!!!) formulae for …rst and second moments and IRFs. Jesús Fernández-Villaverde (PENN) Econometrics March 7, 2016 69 / 69