• No results found

APPENDIX: CO M PUTING THE M ARG INAL LIK ELIHO O D USING THE G ELFAND AND DEY M ETHO D

In document Bibs Sampling Matlab Book Code (Page 140-145)

An introduction to the the Metropolis Hastings Algorithm

8. APPENDIX: CO M PUTING THE M ARG INAL LIK ELIHO O D USING THE G ELFAND AND DEY M ETHO D

8. Appendix: Computing the marginal likelihood using the Gelfand and Dey method

Gelfand and Dey (1994) introduce a method for computing the marginal likelihood that is particularly convenient to use when employing the Metropolis Hastings algorithm. This method is based on the following result.

 ∙  (Φ)  ( \Φ) ×  (Φ)\ ¸ = 1  ( ) (8.1)

where  ( \Φ) denotes the likelihood function,  (Φ) is the prior distribution,  ( ) is the marginal likelihood and  (Φ) is any pdf with support Θ defined within the region of the posterior. The proof of equation 8.1 can be obtained by noting that h (\Φ)× (Φ) (Φ) \i =

Z

 (Φ)

 (\Φ)× (Φ) ×  (Φ\ ) Φ where  (Φ\ ) is the posterior distribution.

Note that  (Φ\ ) =  (\Φ)× (Φ) ( ) and the density  (Φ) integrates to 1 leaving us with the right hand side in

equation 8.1.

We can approximate the marginal likelihood as 1 

X

=1

 (Φ)

 (\Φ)× (Φ) where Φ denotes draws of the parameters

from Metropolis Hastings algorithm and  ( \Φ) ×  (Φ) is the posterior evaluated at each draw. Geweke (1998)

recommends using a truncated normal distribution for  (Φ). This distribution is truncated at the tails to ensure that  (Φ) is bounded from above, a requirement in Gelfand and Dey (1994). In particular, Geweke (1998) suggest using  (Φ) = 1  (2)2 ¯ ¯ ¯ˆΣ¯¯¯−12exp ∙ −05³Φ− ˆΦ ´ ˆ Σ−1³Φ− ˆΦ ´0¸ × ³Φ∈ ˆΘ ´ (8.2) where ˆΦ is the posterior mean, ˆΣ is the posterior covariance and k is the number of parameters. The indicator function ³Φ∈ ˆΘ ´ takes a value of 1 if ∙³ Φ − ˆΦ´Σˆ−1³Φ − ˆΦ´0 ¸ ≤ 21−() where 2

1−() is the inverse 2 cumulative distribution function with degrees of freedom  and probability  Thus

2

1−() denotes the value that exceeds 1 − % of the samples from a 2distribution with  degrees of freedom. The

indicator function ³Φ ∈ ˆΘ

´

therefore removes ‘extreme’ values of Φ For more details, see Koop (2003) page 104.

In figures 30 and 31 we estimate the marginal likelihood for a linear regression model via the Gelfand and Dey method. The model is exactly used in the appendix to Chapter 1 and is based on artifical data. A simple random walk Metropolis Hastings algorithm is used to approximate the posterior on lines 35 to 62 and we save the log posterior evaluated at each draw and each draw of the parameters. Lines 65 and 66 calculate the posterior mean and variance. We set 1 −  = 01 on line 68. In practice, different value of 1 −  can be tried to check robustness of the estimate. On line 70 we evaluate the inverse 2CDF. Line 71 to 78, loop through the saved draws of the parameters. On 73 we

calculate ³Φ − ˆΦ´Σˆ−1³Φ − ˆΦ´0 If this is less than or equal to 2

1−() we evaluate

 (Φ)

 (\Φ)× (Φ) in logs, adding

8. APPENDIX: CO M PUTING THE M ARG INAL LIK ELIHO O D USING THE G ELFAND AND DEY M ETHO D 135

Bibliography

Banbura, Marta, Domenico Giannone and Lucrezia Reichlin, 2007, Bayesian VARs with Large Panels, CEPR Dis- cussion Papers 6326, C.E.P.R. Discussion Papers.

URL:http://ideas.repec.org/p/cpr/ceprdp/6326.html

Bauwens, Luc, Michel Lubrano and Jean François Richard, 1999, Bayesian inference in dynamic econometric models, Oxford University Press.

Benati, Luca and Haroon Mumtaz, 2006, US evolving Macroeconomic Dynamics: A structural investigation., Mimeo European Central Bank.

Bernanke, Ben, Jean Boivin and Piotr S. Eliasz, 2005, Measuring the Effects of Monetary Policy: A Factor-augmented Vector Autoregressive (FAVAR) Approach, The Quarterly Journal of Economics 120(1), 387—422.

URL:http://ideas.repec.org/a/tpr/qjecon/v120y2005i1p387-422.html

Canova, Fabio, 2007, Methods for Applied Macroeconomic Research, Princeton University Press, Princeton.

Carriero, Andrea, George Kapetanios and Massimiliano Marcellino, 2010, Forecasting Government Bond Yields with Large Bayesian VARs, Working Papers 662, Queen Mary, University of London, School of Economics and Finance. URL:http://ideas.repec.org/p/qmw/qmwecw/wp662.html

Carter, C. K. and R. Kohn, 1994, On Gibbs sampling for state space models, Biometrika 81(3), 541—553. URL:http://biomet.oxfordjournals.org/content/81/3/541.abstract

Casella, George and Edward I. George, 1992, Explaining the Gibbs Sampler, The American Statistician 46(3), pp. 167—174.

URL:http://www.jstor.org/stable/2685208

Chen, Cathy W. S. and Jack C. Lee, 1995, BAYESIAN INFERENCE OF THRESHOLD AUTOREGRESSIVE MODELS, Journal of Time Series Analysis 16(5), 483—492.

URL:http://dx.doi.org/10.1111/j.1467-9892.1995.tb00248.x

Chib, Siddhartha, 1993, Bayes regression with autoregressive errors : A Gibbs sampling approach, Journal of Econo- metrics 58(3), 275—294.

URL:http://ideas.repec.org/a/eee/econom/v58y1993i3p275-294.html

Chib, Siddhartha, 1995, Marginal Likelihood from the Gibbs Output, Journal of the American Statistical Association 90(432), 1313—1321.

URL:http://www.jstor.org/stable/2291521

Chib, Siddhartha and Srikanth Ramamurthy, 2010, Tailored randomized block MCMC methods with application to DSGE models, Journal of Econometrics 155(1), 19—38.

URL:http://ideas.repec.org/a/eee/econom/v155y2010i1p19-38.html

Cogley, Timothy and Thomas J. Sargent, 2002, Evolving Post-World War II U.S. Inflation Dynamics, NBER Macro- economics Annual 2001, Volume 16, NBER Chapters, National Bureau of Economic Research, Inc, pp. 331—388. URL:http://ideas.repec.org/h/nbr/nberch/11068.html

Doan, Thomas, Robert B. Litterman and Christopher A. Sims, 1983, Forecasting and Conditional Projection Using Realistic Prior Distributions, NBER Working Papers 1202, National Bureau of Economic Research, Inc.

URL:http://ideas.repec.org/p/nbr/nberwo/1202.html

Fry, Renee and Adrian Pagan, 2007, Some Issues in Using Sign Restrictions for Identifying Structural VARs, NCER Working Paper Series 14, National Centre for Econometric Research.

URL:http://ideas.repec.org/p/qut/auncer/2007-8.html

Gelfand, A. E. and D. K. Dey, 1994, Bayesian Model Choice: Asymptotics and Exact Calculations, Journal of the Royal Statistical Society. Series B (Methodological) 56(3), pp. 501—514.

URL:http://www.jstor.org/stable/2346123

Gelman, Andrew and Donald B. Rubin, 1992, Inference from Iterative Simulation Using Multiple Sequences, Statistical Science 7(4), pp. 457—472.

URL:http://www.jstor.org/stable/2246093

Geweke, John, 1991, Evaluating the accuracy of sampling-based approaches to the calculation of posterior moments, Technical report.

Geweke, John, 1998, Using simulation methods for Bayesian econometric models: inference, development, and com- munication, Technical report.

Hamilton, J. D., 1994, Time series analysis, Princeton University Press, Princeton.

Jacquier, E, N Polson and P Rossi, 2004, Bayesian analysis of stochastic volatility models, Journal of Business and Economic Statistics 12, 371—418.

Kadiyala, K Rao and Sune Karlsson, 1997, Numerical Methods for Estimation and Inference in Bayesian VAR-Models, Journal of Applied Econometrics 12(2), 99—132.

URL:http://ideas.repec.org/a/jae/japmet/v12y1997i2p99-132.html

Kim, C-J. and C. R. Nelson, 1999, State-space models with regime switching, MIT Press, Cambridge, Massachusetts. Kim, Sangjoon, Neil Shephard and Siddhartha Chib, 1998, Stochastic Volatility: Likelihood Inference and Comparison

with ARCH Models, Review of Economic Studies 65(3), 361—93. URL:http://ideas.repec.org/a/bla/restud/v65y1998i3p361-93.html Koop, Gary, 2003, Bayesian Econometrics, Wiley.

Negro, Marco Del and Frank Schorfheide, 2004, Priors from General Equilibrium Models for VARS, International Economic Review 45(2), 643—673.

URL:http://ideas.repec.org/a/ier/iecrev/v45y2004i2p643-673.html

Primiceri, G, 2005, Time varying structural vector autoregressions and monetary policy, The Review of Economic Studies 72(3), 821—852.

Ramirez, Juan Rubio, Daniel Waggoner and Tao Zha, 2010, Structural Vector Autoregressions: Theory of Identifi- cation and Algorithms for Inference, Review of Economic Studies 77(2), 665—696.

URL:http://ideas.repec.org/a/bla/restud/v77y2010i2p665-696.html

Robertson, John C. and Ellis W. Tallman, 1999, Vector autoregressions: forecasting and reality, Economic Review (Q1), 4—18.

URL:http://ideas.repec.org/a/fip/fedaer/y1999iq1p4-18nv.84no.1.html

Robertson, John C, Ellis W Tallman and Charles H Whiteman, 2005, Forecasting Using Relative Entropy, Journal of Money, Credit and Banking 37(3), 383—401.

URL:http://ideas.repec.org/a/mcb/jmoncb/v37y2005i3p383-401.html

Sims, Christopher A and Tao Zha, 1998, Bayesian Methods for Dynamic Multivariate Models, International Economic Review 39(4), 949—68.

URL:http://ideas.repec.org/a/ier/iecrev/v39y1998i4p949-68.html

Villani, Mattias, 2009, Steady-state priors for vector autoregressions, Journal of Applied Econometrics 24(4), 630— 650.

URL:http://dx.doi.org/10.1002/jae.1065

Waggoner, Daniel F. and Tao Zha, 1999, Conditional Forecasts In Dynamic Multivariate Models, The Review of Economics and Statistics 81(4), 639—651.

URL:http://ideas.repec.org/a/tpr/restat/v81y1999i4p639-651.html

In document Bibs Sampling Matlab Book Code (Page 140-145)

Related documents