ESTIMATION of a DSGE MODEL Paris, October 17 2005 STÉPHANE ADJEMIAN stephane.adjemian@ens.fr UNIVERSITÉ DU MAINE & CEPREMAP Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 1/3
Bayesian approach A bridge between calibration and maximum likelihood. Uncertainty and a priori knowledge about the model and its parameters are described by prior probabilities. Confrontation to the data, through the likelihood function, leads to a revision of these probabilities ( posterior probabilities). Testing and model comparison is done by comparing posterior probabilities (over models). Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 2/3
Prior density The prior density describes a priori beliefs, before observing the data: p(θ A A) A stands for a specific model. θ A represents the parameters of model A. p( ) normal, gamma, shifted gamma, inverse gamma, beta, generalized beta, uniform... Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 3/3
Likelihood function The likelihood describes the density of the observed data, given the model and its parameters: L(θ A Y T, A) p(y T θ A, A) Y T are the observations until period T. In our case, the likelihood is recursive: p(y T θ A, A) = p(y 0 θ A, A) T t=1 p(y t Y t 1,θ A, A) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 4/3
Bayes theorem We have a prior density p(θ) and the likelihood p(y T θ). We are interested in p(θ Y T ), the posterior density. Using the Bayes theorem twice we obtain the density of the parameters knowing the data: We have: and also p(θ Y T ) = p(θ;y T) p(y T ) p(y T θ) = p(θ;y T) p(θ) p(θ;y T ) = p(y T θ) p(θ) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 5/3
Posterior kernel and density By substitution, we get the posterior density: p(θ A Y T, A) = p(y T θ A, A)p(θ A A) p(y T A) Where p(y T A) is the marginal density of the data conditional on the model: p(y T A) = p(θ A ;Y T A)dθ A Θ A The posterior kernel (un-normalized posterior density): p(θ A Y T, A) p(y T θ A, A)p(θ A A) K(θ A Y T, A) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 6/3
A simple example (I) Data Generating Process y t = µ + ε t, with t = 1,...,T where ε t N(0, 1) is a gaussian white noise. The likelihood is given by p(y T µ) = (2π) T 2 e 1 2 P T t=1 (y t µ) 2 µ ML,T = 1 T T t=1 y t y Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 7/3
A simple example (II) Note that the variance of this estimator is a simple function of the sample size V[ µ ML,T ] = 1 T Let our prior be a gaussian distribution with expectation µ 0 and variance σ 2 µ. The posterior density is defined, up to a constant, by: p (µ Y T ) (2πσ 2 µ) 1 2 e 1 2 (µ µ 0 ) 2 σ 2 µ (2π) T 2 e 1 2 P T t=1 (y t µ) 2 Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 8/3
A simple example (III)... Or equivalently 2 p (µ Y T ) e (µ E[µ]) V[µ] the posterior distribution is gaussian, with: V[µ] = 1 ( 1T ) 1 + σ 2 µ and E[µ] = ( 1T ) 1 µml,t + σ 2 µ µ 0 ( 1T ) 1 + σ 2 µ Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 9/3
A simple example (The bridge, IV) E[µ] = ( 1T ) 1 µml,t + σ 2 µ µ 0 ( 1T ) 1 + σ 2 µ The posterior mean is a convex combination of the prior mean and the ML estimate. If σ 2 µ (no prior information) then E[µ] µ ML,T. If σ 2 µ 0 (calibration) then E[µ] µ 0. Not so simple if the model is non linear in the estimated parameters... In general we have to follow a simulation based approach to get the posterior distributions and moments. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 10/3
Model comparison (I) Suppose we have two models A and B (with two associated vectors of deep parameters θ A and θ B ) estimated using the same sample Y T. For each model I = A, B we can evaluate, at least theoretically, the marginal density of the data conditional on the model: p(y T I) = p(θ I I) p(y T θ I, I)dθ I Θ I by integrating out the deep parameters θ I from the posterior kernel. p(y T I) measures the fit of model I. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 11/3
model A model B p(y T A) p(y T B) Y T Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 12/3
Model comparison (II) Suppose we have a prior distribution over models: p(a) and p(b). Again, using the Bayes theorem we can compute the posterior distribution over models: p(i Y T ) = p(i)p(y T I) I=A,B p(i)p(y T I) This formula may easily be generalized to a collection of N models. Posterior odds ratio: p(a Y T ) p(b Y T ) = p(a) p(b) p(y T A) p(y T B) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 13/3
In practice... We may be interested in: Estimating some posterior moments. Estimating the posterior marginal density to compare models. We can do it by hand for linear models (for instance VAR models) by carefully choosing the priors...... But it s impossible for DSGE models. We use a simulation based approach. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 14/3
Metropolis algorithm (I) 1. Choose a starting point θ & run a loop over 2-3-4. 2. Draw a proposal θ from a jumping distribution J(θ θ t 1 ) = N(θ t 1,cΣ m ) 3. Compute the acceptance ratio r = p(θ Y T ) p(θ t 1 Y T ) = K(θ Y T ) K(θ t 1 Y T ) 4. Finally θ t = { θ with probability min(r, 1) θ t 1 otherwise. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 15/3
posterior kernel K(θ o ) θ o Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 16/3
K ( θ 1) = K(θ ) posterior kernel K(θ o ) θ o θ 1 = θ Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 17/3
K ( θ 1) posterior kernel K(θ o ) K(θ )?? θ o θ 1 θ Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 18/3
Metropolis algorithm (II) How should we choose the scale factor c (variance of the jumping distribution)? The acceptance ratio should be strictly positive and not too important. How many draws? Convergence has to be assessed... Parallel Markov chains Pooled moments have to be close to Within moments. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 19/3
Approximation of the marginal density By definition we have: p(y T A) = p(θ A Y T, A)p(θ A A)dθ A Θ A By assuming that the posterior density is gaussian (Laplace approximation) we have the following estimator: p(y T A) = (2π) k 2 Σθ m A 1 2 p(θ m A Y T, A)p(θ m A A) where θ m A is the posterior mode. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 20/3
Harmonic mean (I) Note that " # f(θ A ) E A p(θ A A)p(Y T θ A, A) θa, = Z f(θ A )p(θ A Y T, A) Θ A p(θ A A)p(Y T θ A, A) dθ A where f is a density function. The right member of the equality, using the definition of the posterior density, may be rewritten as Z f(θ A ) Θ A p(θ A A)p(Y T θ A, A) p(θ A A)p(Y T θ A, A) RΘ A p(θ A A)p(Y T θ A, A)dθ A dθ A Finally, we have " # f(θ A ) E A p(θ A A)p(Y T θ A, A) θa, = R Θ f(θ)dθ R A Θ p(θ A A A)p(Y T θ A, A)dθ A Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 21/3
Harmonic mean (II) So that p(y T A) = E [ f(θ A ) ] 1 θ A, A p(θ A A)p(Y T θ A, A) This suggests the following estimator of the marginal density p(y T A) = [ 1 B B b=1 f(θ (b) A ) p(θ (b) A A)p(Y T θ (b) A, A) Each drawn vector θ (b) A comes from the Metropolis-Hastings monte-carlo. ] 1 Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 22/3
Harmonic mean (III) The preceding proof holds if we replace f(θ) by 1 Simple Harmonic Mean estimator. But this estimator may also have a huge variance. The density f(θ) may be interpreted as a weighting function, we want to give less importance to extremal values of θ. Geweke (1999) suggests to use a truncated gaussian function (modified harmonic mean estimator). Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 23/3
DSGE model (I) Any DSGE model may be represented as follows with: E t [ǫ t+1 ] = 0 E t [ ǫt+1 ǫ t+1] = Σǫ E t [f θ (y t+1,y t,y t 1,ǫ t )] = 0 where: y is the vector of endogenous variables, ǫ is the vector of exogenous stochastic shocks, θ is the vector of deep parameters. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 24/3
DSGE model (II, solution) We linearize the model around a deterministic steady state ȳ(θ) (such that f θ (ȳ,ȳ,ȳ, 0) = 0). Solving the linearized version of this model (with dynare for instance), we get a state space reduced form representation: y t ŷ t = Mȳ(θ) + Mŷ t +η t = g y (θ)ŷ t 1 + g u (θ)ǫ t E [ ǫ t ǫ t] = Σǫ E [ η t η t] = V The reduced form is non linear in the deep parameters... Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 25/3
DSGE model (III, Kalman filter)... But linear in the endogenous and exogenous variables. So that the likelihood may be evaluated with a linear prediction error algorithm. Kalman Filter recursion, for t = 1,...,T : v t F t K t ŷ t+1 = y t ȳ (θ) Mŷ t = MP t M + V = g y (θ)p t M Ft 1 = g y (θ)ŷ t + K t v t P t+1 = g y (θ)p t (g y (θ) K t M) + g u (θ)σ ǫ g u (θ) with initial conditions y 1 and P 1. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 26/3
DSGE model (IV, likelihood & posterior) We have to estimate θ, Σ ǫ and V The log-likelihood is defined by : log L(θ Y T ) = Tk 2 log 2π 1 2 T t=1 log F t 1 2 T t=1 v tf t 1 v t where the vector θ contains the k parameters to be estimated (θ, vech(σ ǫ ) and vech(v )). The log posterior kernel is then defined by : log K(θ YT ) = log L(θ Y T ) + log p(θ) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 27/3
Rabanal & Rubio-Ramirez 2001 (I) New keynesian models. Common equations : y t = E t y t+1 σ(r t E t p t+1 + E t g t+1 g t ) y t = a t + (1 δ)n t mc t = w t p t + n t y t mrs t = 1 σ y t + γn t g t r t = ρ r r t 1 + (1 ρ r ) [γ π p t + γ y y t ] + z t w t p t = w t 1 p t 1 + w t p t a t,g t AR(1), z t,λ t are gaussian white noises. Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 28/3
Rabanal & Rubio-Ramirez 2001 (II) Baseline sticky prices model (BSP) : p t = βe [ p t+1 + κ p (mc t + λ t )] w t p t = mrs t Sticky prices & Price indexation (INDP) : p t = γ b p t 1 + γ f E [ p t+1 + κ p(mc t + λ t ) ] w t p t = mrs t Sticky prices & wages (EHL) : p t = βe t [ p t+1 + κ p (mc t + λ t )] w t = βe t [ w t+1 ] + κ w [mrs t (w t p t )] Sticky prices & wages + Wage indexation (INDW) : w t α p t 1 = βe t [ w t+1 ] αβ p t + κ w [mrs t (w t p t )] Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 29/3
DYNARE (I) var a g mc mrs n pie r rw winf y; varexo e_a e_g e_lam e_ms; parameters invsig delta... ; model(linear); y=y(+1)-(1/invsig)*(r-pie(+1)+g(+1)-g); y=a+(1-delta)*n; mc=rw+n-y;... end; Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 30/3
DYNARE (II) estimated_params; stderr e_a, uniform_pdf,,,0,1; stderr e_lam, uniform_pdf,,,0,1;... rho,uniform_pdf,,,0,1; gampie, normal_pdf, 1.5, 0.25;... end; varobs pie r y rw; estimation(datafile=dataraba,first_obs=10,...,mh_jscale=0.5); Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 31/3
Posterior mode Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 32/3
Posterior mode 0.3 omega (Interval) 12 x 10 3 omega (m2) 2.5 x 10 3 omega (m3) 0.28 0.26 0.24 10 8 2 1.5 1 0.22 2 4 6 6 2 4 6 0.5 2 4 6 0.08 rhoa (Interval) x 10 4 10 x 10 4 rhoa (m2) x 10 4 5 x 10 5 rhoa (m3) x 10 4 0.07 0.06 8 6 4 3 2 0.05 2 4 6 4 2 4 6 1 2 4 6 0.14 rhog (Interval) x 10 4 2.5 x 10 3 rhog (m2) x 10 4 2 x 10 4 rhog (m3) x 10 4 0.12 2 1.5 0.1 1.5 1 0.08 2 4 6 1 2 4 6 0.5 2 4 6 x 10 4 x 10 4 x 10 4 Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 33/3
Posterior distributions (I) Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 34/3
Posterior distributions (II) SE_e_a SE_e_g SE_e_ms 300 30 200 100 20 10 2000 1000 0 0 0.5 1 0 0 0.5 1 0 0 0.5 1 SE_e_lam invsig gam 2 1.5 1 0.5 0.3 0.2 0.1 1.5 1 0.5 0 0 0.5 1 0 0 10 20 30 0 0 1 2 rho gampie gamy 10 2 6 4 5 1 2 0 0 0.5 1 0 1 1.5 2 2.5 0 0.2 0 0.2 0.4 Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 35/3
Posterior distributions (III) omega rhoa 4 15 3 10 2 1 5 0 0 0.5 1 0 0 0.2 0.4 0.6 0.8 1 10 rhog 0.4 thetabig 8 0.3 6 4 0.2 2 0.1 0 0 0.2 0.4 0.6 0.8 1 0 2 4 6 8 10 12 14 Slides.tex ESTIMATION of a DSGE MODEL STÉPHANE ADJEMIAN 16/10/2005 21:37 p. 36/3