Bayesian VAR Forecasting

Questions and discussions on Vector Autoregressions
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Dear Tom,

I hope this finds you well,

I would like to compare the forecasting performance of a BVAR model with a classic VAR one, as in the example (7.8) Using RUNTHEIL, in the user guide.

I wonder if I can compare the "new" model that results in the Gibbs sampler "loop" after the command "compute %modelsetcoeffs(SNVAR_EG1,bdraw)" to a classic VAR model estimated using SUR?

Is this doable?

Thank you in advance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Bayesian VAR Forecasting

Unread post by TomDoan »

It would be much more complicated than what @RunTHEIL does. That compares forecasts produced by point estimates of different VAR's. The Gibbs sampler instead produces a "cloud" of forecasts instead of a single set of numbers. So the performance statistics would have to somehow be averaged across simulations.
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Hi Tom,

My idea is: the BVAR in the @RunTHEIL is based on the basic Minnesota prior, with the possibility of changing its hyperparameters, but the prior that I implement is the independent normal wishart one with informative Minnesota on the coefficients, and the forecasting performance resulting from the model with the latter prior is the one that I want to compare to a classic one estimated with sur to tackle the change in the errors variance.

So If there isn't a ready code for this, would you kindly give me ideas so I can implement it?

Thank you and best refagards.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Bayesian VAR Forecasting

Unread post by TomDoan »

@RunTheil does a sequence of estimates using Kalman filter. You really can't do that with the Gibbs sampler without a staggering number of calculations. In order to get the "point" forecasts for the Gibbs sampler for a fixed estimation interval, you would have to generate VAR coefficients using the Gibbs sampler, generate a set of forecasts from that, and average across forecasts across sampled models. That would correspond to the point forecasts out of the simpler form of BVAR. You would need quite a few draws in order to make that sufficiently accurate. Rolling that forward would require redoing that whole sequence of calculations.
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Thank you for the reply.

Would you kindly give me more help with some routines guiding me to the application of this. In the following paper, footnote (7) page 13, I think the same idea is applied.

http://www.imf.org/external/pubs/ft/wp/2008/wp0846.pdf

On the other hand, in the same paper, Historical Decomposition, conditional and unconditional forecasting are conducted with BVAR model, would you kindly tell me how this is applied with Rats.

Many thanks to you
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Dear Tom,

I hope this finds you well,

I have some questions concerning your last post.

"In order to get the "point" forecasts for the Gibbs sampler for a fixed estimation interval, you would have to generate VAR coefficients using the Gibbs sampler, generate a set of forecasts from that, and average across forecasts across sampled models. That would correspond to the point forecasts out of the simpler form of BVAR. You would need quite a few draws in order to make that sufficiently accurate. Rolling that forward would require redoing that whole sequence of calculations."

What do you mean here by fixed estimation interval?

What do you mean across sampled models?

How many are "Quite few draws" for you?

"Rolling that forward" could be done by estimating the VAR model, before the loop, with an additional point and redo the whole sequence of calculations? This could be done by a loop for the whole code?

Thank you in advance
tclark
Posts: 99
Joined: Wed Nov 08, 2006 3:20 pm

Re: Bayesian VAR Forecasting

Unread post by tclark »

For what it is worth, I think you should be able to find answers to many of your questions about forecasting with Bayesian VARs in the 1997 paper in the Journal of Applied Econometrics by Kadiyala and Karlsson and in a chapter on forecasting with Bayesian VARs that Karlsson wrote for the recently published vol. 2 of the Handbook of Economic Forecasting (Elsevier).
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Dear Tom,

I'm sorry to bother you with so many questions, I tried to implement what you recommended me to do to compare the forecasting performance of a BAVR estimated with Gibbs sampling and classical VAR one.

I need only a confirmation that what I did is correct.

I have a data sample 1974-2010,

I estimate the classical VAR for 1974-2004, then i use the command simulate to forecast with this model, is it ok to do this with a classical VAR?

Simulate(model=SBVAR_EG,results=Clas_simresults,from=fstart,to=fend)

Then I compute the RMSE to measure the forecating performance of the model using:

Do i=1,nvar
Set forecastEorrder0(i) fstart fend = (%modeldepvars(SBVAR_EG)(i)- Clas_simresults(i))**2
Sstats(mean) fstart fend forecastEorrder0(i)>>SSE0(i)
Compute RMS0(i) = sqrt(SSE0(i))
Display RMS0(i)
End do i

Then for the BVAR model, within the gibbs sampling loop, I do the same with each new coefficients:

compute %modelsetcoeffs(SBVAR_EG,bdraw)

Simulate(model=SBVAR_EG,cv=sigmad,results=simresults,from=fstart,to=fend)

Do i=1,nvar

set forecast(i) fstart fend = forecast(i)+simresults(i)
set forestderr(i) fstart fend = forestderr(i)+simresults(i)**2

End do i
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

Dear Tom,

I'm sorry to bother you with so many questions, I tried to implement what you recommended me to do to compare the forecasting performance of a BAVR estimated with Gibbs sampling and classical VAR one.

I need only a confirmation that what I did is correct.

I have a data sample 1974-2010,

I estimate the classical VAR for 1974-2004, then i use the command simulate to forecast with this model, is it ok to do this with a classical VAR?

Simulate(model=SBVAR_EG,results=Clas_simresults,from=fstart,to=fend) This goes forward for two years.

Then I compute the RMSE to measure the forecating performance of the model using:

Do i=1,nvar
Set forecastEorrder0(i) fstart fend = (%modeldepvars(SBVAR_EG)(i)- Clas_simresults(i))**2
Sstats(mean) fstart fend forecastEorrder0(i)>>SSE0(i)
Compute RMS0(i) = sqrt(SSE0(i))
Display RMS0(i)
End do i

Then for the BVAR model, within the gibbs sampling loop, I do the same with each new coefficients:

compute %modelsetcoeffs(SBVAR_EG,bdraw)

Simulate(model=SBVAR_EG,cv=sigmad,results=simresults,from=fstart,to=fend)

Do i=1,nvar

set forecast(i) fstart fend = forecast(i)+simresults(i)
set forestderr(i) fstart fend = forestderr(i)+simresults(i)**2

End do i

outside the loop, I compute the performance statistics as above:

Do i=1,nvar
Set forecast(i) fstart fend = forecast(i)/ndraws
Set forecastEorrder(i) fstart fend = (%modeldepvars(SBVAR_EG)(i)- forecast(i))**2
Sstats(mean) fstart fend forecastEorrder(i)>>SSE(i)
Compute RMS(i) = sqrt(SSE(i))
Display RMS(i)
End do i

Then i divide both results to get relative performance statistics of both model. I repeat the whole calculation again for 1974-2005, etc.

What do you think?

Do you recommend the command forecast instead of simulate?

Thank you for your time.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Bayesian VAR Forecasting

Unread post by TomDoan »

No. Neither of those will be correct. SIMULATE just gives you one random simulation of the process---it's not a forecast. If there's no closed form for computing forecasts, you need to compute a large number of simulations, and take the mean or median of those as the forecast. That's what the authors of the paper say they did (in their case taking the median).
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

what do you mean by "If there's no closed form for computing forecasts, you need to compute a large number of simulations"

So what do you recommend me to do, is there any program that did some thing similar?

Or what is the command that I should use to do this?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Bayesian VAR Forecasting

Unread post by TomDoan »

AhmedSahlool wrote:what do you mean by "If there's no closed form for computing forecasts, you need to compute a large number of simulations"

So what do you recommend me to do, is there any program that did some thing similar?

Or what is the command that I should use to do this?
Would "no analytical expression" make more sense than "closed form"?

There are many, but see GIBBSVAR.RPF.
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

In the gibbsvar.rpf, I can only see the simulate instruction, and it's used as I did, no?

Shouldn't it be used with classical VAR model? is that what do you mean?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Bayesian VAR Forecasting

Unread post by TomDoan »

Sorry, yes. I didn't notice that you said that that was all inside the Gibbs loop.
AhmedSahlool
Posts: 78
Joined: Tue Jul 05, 2011 5:57 am

Re: Bayesian VAR Forecasting

Unread post by AhmedSahlool »

And what about using it with classical VAR, as following:

Sur(print,robuserrors,model=SBVAR_EG,RESIDS=sisi) 8 1978:1 2005:1

Simulate(model=SBVAR_EG,results=Clas_simresults,from=fstart,to=fend)

Do i=1,nvar
Set forecastEorrder0(i) fstart fend = (%modeldepvars(SBVAR_EG)(i)- Clas_simresults(i))**2
Sstats(mean) fstart fend forecastEorrder0(i)>>SSE0(i)
Compute RMS0(i) = sqrt(SSE0(i))
Display RMS0(i)
End do i

Is this correct, or I should use the command forecast instead, and replace Simulate for the BVAR also with forecast.
Post Reply