M A -L L I , O I P R D E W O M O - S , O P D W P AC CR RO IN NK KA AG GE ES IL L RI IC CE ES S A AN ND D EF FL LA AT TI IO ON N OR RK KS SH HO OP J A 6– –9 9, , 20 00 09 9 J 6 2 AN NU UA AR RY Y Bayesian Estimation of GPM with DYNARE Michel Juillard
Outline Bayesian Estimation of GPM with Dynare 1. Introduction to Bayesian estimation Macro–Financial Linkages, Oil Prices and Deflation IMF 2. Bayesian estimation in Dynare workshop 3. Dealing with nonstationary variables 4. Example: A simple GPM model for the US Michel Juillard 5. Dynare macro language 6. Example: A 6–country GPM model January 6, 2009 Introduction to Bayesian estimation Bayesian ingredients ◮ Uncertainty and a priori knowledge about the model and its parameters are described by prior probabilities ◮ Choosing prior density ◮ Confrontation to the data leads to a revision of these ◮ Computing posterior mode probabilities (posterior probabilities) ◮ Simulating posterior distribution ◮ Point estimates are obtained by minimizing a loss function ◮ Computing point estimates and confidence regions (analogous to economic decision under uncertainty) ◮ Computing posterior probabilities ◮ Testing and model comparison is done by comparing posterior probabilities
Prior density Likelihood function ◮ Conditional density p ( y | θ A , A ) ◮ Conditional density for dynamic timeseries models p ( θ A | A ) T � where A represents the model and θ A , the parameters of that p ( Y T | θ A , A ) = p ( y 0 | θ A , A ) p ( y t | Y t − 1 , θ A , A ) model. t = 1 The prior density describes a priori beliefs, before considering where Y T are the observations until period T the data. ◮ Likelihood function L ( θ A | Y T , A ) = p ( Y T | θ A , A ) Marginal density Posterior density ◮ Posterior density � p ( θ A | Y T , A ) = p ( θ A | A ) p ( Y T | θ A , A ) p ( y | A ) p ( y , θ A | A ) d θ A = p ( Y T | A ) Θ A � p ( y | θ A , A ) p ( θ A | A ) d θ A ◮ Unnormalized posterior density or posterior density kernel = Θ A p ( θ A | Y T , A ) ∝ p ( θ A | A ) p ( Y T | θ A , A )
Posterior predictive density Bayes risk function � R ( a ) E [ L ( a , θ )] = p (˜ Y | Y T , A ) p (˜ Y , θ A | Y T , A ) d θ A � = L ( a , θ A ) p ( θ A ) d θ A Θ A = � Θ A p (˜ Y | θ A , Y T , A ) p ( θ A | Y T , A ) d θ A = Θ A where L ( a , θ ) is the loss function associated with decision a when parameters take value θ A . Estimation Credible sets Action: deciding that the estimated value of θ A is � θ A � ◮ Point estimate: P ( θ ∈ C ) = p ( θ ) d θ = 1 − α � C L ( � θ A , θ A ) p ( θ A | Y T , A ) d θ A � θ A = arg min is a 100 ( 1 − α )% credible set for θ with respect to p ( θ ) . e θ A Θ A A 100 ( 1 − α )% highest probability density (HPD) credible set ◮ Quadratic loss function: for θ with respect to p ( θ ) is a 100 ( 1 − α )% credible set with the θ A = E ( θ A | Y T , A ) � property p ( θ 1 ) ≥ p ( θ 2 ) ∀ θ 1 ∈ C and ∀ θ 2 ∈ ¯ C ◮ Zero-one loss function: � θ A = posterior mode
Numerical integration Metropolis algorithm � E ( h ( θ A )) h ( θ A ) p ( θ A | Y T , A ) d θ A = 1. Draw a starting point θ ◦ which p ( θ ) > 0 from a starting Θ A distribution p ◦ ( θ ) . N � 1 h ( θ k ≈ A ) N k = 1 where θ k A is drawn from p ( θ A | Y T , A ) . Metropolis algorithm (continued) In practice . . . 2. For t = 1 , 2 , . . . 1. Draw a proposal θ ∗ from a jumping distribution J ( θ ∗ | θ t − 1 ) = N ( θ t − 1 , c Σ mode ) ◮ fix scale factor c so as to obtain a 25% average 2. Compute the acceptance ratio acceptance ratio ◮ discard first 50% of the draws p ( θ ∗ ) r = p ( θ t − 1 ) 3. Set � θ ∗ with probability min ( r , 1 ) θ t = θ t − 1 otherwise.
Potential Scale Reduction Factor Multivariate PSRF If we have simulated m independant sequences of n draws, a particular draw of scalar θ is noted θ ij with i = 1 , . . . , n and � � j = 1 , . . . , m . n − 1 1 + 1 V W + B / n ˆ = n m m n � � ¯ � 2 B m n θ · j − ¯ � � = θ ·· 1 m − 1 W ( θ ij − θ · j )( θ ij − θ · j ) ′ = j = 1 m ( n − 1 ) j = 1 i = 1 m n � � � � 2 1 1 W m � = θ ij − θ · j 1 m n − 1 B / n ( θ · j − θ ·· )( θ · j − θ ·· ) ′ = j = 1 i = 1 m − 1 j = 1 n − 1 W + 1 / n var + ( θ | Y T , A ) � n − 1 + m + 1 = n B R p ˆ = λ 1 � n m var + ( θ | Y T , A ) � R ˆ = λ 1 is the largest eigenvalue of W − 1 B / n W Model comparison Laplace approximation The ratio of posterior probabilities of two models is P ( A k | Y T ) = P ( A j ) P ( A j | Y T ) p ( Y T | A j ) � P ( A k ) p ( Y T | A k ) p ( Y T , A ) p ( θ A | Y T , A ) p ( θ A | A ) d θ A = θ A In favor of the model A j versus the model A k : k 2 p ( θ M A | Y T , A ) p ( θ M M | − 1 p ( Y T | A ) A | A ) 2 | Σ θ ˆ = ( 2 π ) ◮ the prior odds ratio is P ( A j ) / P ( A k ) ◮ the Bayes factor is p ( Y T | A j ) / p ( Y T | A k ) where θ M A is the posterior mode. ◮ the posterior odds ratio is P ( A j | Y T ) / P ( A k | Y T )
Geweke (1999) modified harmonic mean � p ( Y T | A ) p ( θ A | Y T , A ) p ( θ A | A ) d θ A = θ A � � − 1 n f ( θ ( i ) � Bayesian estimation in Dynare A ) 1 p ( Y T | A ) ˆ = n p ( θ ( i ) A | Y T , A ) p ( θ ( i ) A | A ) i = 1 � � − 1 k f ( θ ) p − 1 ( 2 π ) 2 | Σ θ | − 1 2 ( θ − θ ) ′ Σ θ − 1 ( θ − θ ) 2 exp = � � − 1 ( θ − θ ) ≤ F − 1 ( θ − θ ) ′ Σ θ × k ( p ) χ 2 with p an arbitrary probability and k , the number of estimated parameters. Priors in DYNARE How to choose priors ◮ the shape should be consistent with the domain of N ( µ, σ ) R definition of the parameter NORMAL_PDF G 2 ( µ, σ, p 3 ) [ p 3 , + ∞ ) GAMMA_PDF ◮ use values obtained in other studies (micro or macro) B ( µ, σ, p 3 , p 4 ) [ p 3 , p 4 ] BETA_PDF ◮ check the graph of the priors IG 1 ( µ, σ ) R + INV_GAMMA_PDF ◮ check the implication of your priors by running stoch_simul U ( p 3 , p 4 ) [ p 3 , p 4 ] UNIFORM_PDF with parameters set at prior mean By default, p 3 = 0, p 4 = 1. ◮ compare moments of endogenous variables in previous simulation with empirical moments of observed variables ◮ do sensitivity tests by widening your priors
Estimation strategy State space representation (I) ◮ After (log–)linearization around the deterministic steady After solution of a first order approximation of a DSGE model, state, the linear rational expectation model needs to be we obtain a linear dynamic model of the form solved (AIM, Kind and Watson, Klein, Sims) y s y t = ¯ y + g y ˆ t − 1 + g u u t ◮ The model can then be written in state space form ◮ It is an unobserved component model y s the vector ˆ t − 1 contains the endogenous state variables, the ◮ Its likelihood is computed via the Kalman filter predetermined variables among y t , with as many lags as ◮ These steps are common to Maximum Likelihood required by the dynamic of the model. estimation or a Bayesian approach State space representation (II) Other variables The transition equation describes the dynamics of the state The variables that are neither predetermined nor observed, variables: y ( 2 ) , play no role in the estimation of the parameters, and their y ( 1 ) = g ( 1 ) y ( 1 ) t − 1 + g ( 1 ) u u t t ˆ y ˆ t filtered or smoothed values can be recovered from the filtered y ( 1 ) or smoothed values of ˆ where g ( 1 ) and g ( 1 ) are the appropriate submatrices of g x and thanks to the following relationship: t x u is the union of the state variables y s g u , respectively. y ( 1 ) t , t y ( 2 ) = g ( 2 ) y ( 1 ) t − 1 + g ( 2 ) u u t ˆ x ˆ including all necessary lags, and y ⋆ t t , the observed variables. The g ( 1 ) matrix can have eigenvalues equal to one. y
Measurement equation Variances We consider measurement equations of the type In addition, we have, the two following covariance matrices: y ⋆ y + M ˆ y ( 1 ) + x t + ǫ t t = ¯ � � t E u t u ′ Q = t � � where M is the selection matrix that recovers ˆ y ⋆ y ( 1 ) , x t E H t out of ˆ ǫ t ǫ ′ = t t is a deterministic component 1 and ǫ t is a vector of measurement errors. 1 Currently, Dynare only accomodates linear trends Unit root processes Dealing with nonstationary variables ◮ find a natural representation in the state space form ◮ the deterministic components of random walk with drift is better included in the measurement equation
Recommend
More recommend