TVP-VAR related issues

Questions and discussions on Vector Autoregressions
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

TVP-VAR related issues

Unread post by Nord1 »

Hello,

I checked (Nakajima, 2011) and the author is using Geweke's statistic for checking the convergence of the mcmc in the TVP-VAR, is it available on the RATS?? what I am looking for is a sensitivity or test for the model.

Nakajima, J. (2011). "Time-varying parameter VAR model with stochastic volatility: An overview of methodology and empirical application"



how to perform an impulse response analysis for different time horizons, for example, for 4 quarters, 8 quarters, etc... ??

why RATS keep crashing while i am estimating the variables??? I am using RATS 8.01

thank you.
Last edited by Nord1 on Wed Mar 11, 2015 12:53 pm, edited 2 times in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Nord1 wrote:Hello,

I checked other papers (Nakajima, 2011) and they are using Geweke's statistic for checking the convergence of the mcmc in the TVP-VAR, is it available on the RATS?? what I am looking for is a sensitivity or robustness test for the model.

Nakajima, J. (2011). "Time-varying parameter VAR model with stochastic volatility: An overview of methodology and empirical application"
The Geweke CD measure is one of the statistics computed by the @MCMCPOSTPROC procedure. It's not particularly difficult to compute---that's explained as part of the Bayesian Econometrics e-course.
Nord1 wrote: how to perform an impulse response analysis for different time horizons, for example, for 4 quarters, 8 quarters, etc... ??

why RATS keep crashing while i am estimating the variables??? I am using RATS 8.01
The program is a bit of a memory-hog and I believe there was a memory leak in early v8's that added to that. You should contact your department about getting an update. (One of the reasons that we try to keep multiple user licenses on update subscriptions is so that if someone runs into a problem or needs a new feature, the updated software will already be contracted for).
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

Dear Tom,

at the moment, i switched back to version 7.3

may you please correct the following sentence and answer the question,

My output parameters that I got from using the Gibbs sampling in order to compute the posterior distribution of the TVP-VAR parameters are in a matrix form. however, my input should be in a series (vector) form when testing the convergence using @MCMCPOSTPROC . how to test the convergence of the parameters in this case using the procedure ??? ie. testing the convergence of PiRes, LambdaRes, and PiRes

I am using the same Primiceri (2005) example posted on this website.

thank you,
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

gewekecd.src
Procedure for computing Geweke CD
(1.92 KiB) Downloaded 1693 times
This is a procedure for doing the CD measure on a single series. In this case, you have a lot of different series of Gibbs statistics and some are more likely to be problems than others. I hope the papers who've read will help you focus on the ones that are most likely to tell you if the chain is working properly.
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

Dear Tom,

Thank you for posting the new procedure. There are a few points, I am following Primiceri (2005) original paper, which is replicated on https://estima.com/forum/viewtopic.php?f=5&t=781 and at the moment I am using the same data posted with the example. On pg. 29 of the non-published copy of the paper, Primiceri used Geweke measure as part of testing the convergence and the sensitivity test of the MCMC. Following Primiceri (2005), I want to focus on the convergence of V, Sigma,A, and B.
Therefore, I want to test the convergence of PiRes, Ares, LambdaRes, and SRes as following:

@gewekecd (ndraws=ndraws,mean=bmean,stderrs=bstderrs,$
cd=bcd,nse=bnse) PiRes Ares LambdaRes
report(action=define)
report(atrow=1,atcol=1,align=center) "Variable" "Coeff" "Std Error" $
"NSE" "CD"
do i=1,%nreg
report(row=new,atcol=1) "B","A","S",”V” +i bmean(i) bstderrs(i) bnse(i) bcd(i)
end do i
report(action=format,atcol=2,tocol=3,picture="*.###")
report(action=format,atcol=4,picture="*.##")
report(action=show)


I am getting the following error message:
## SX20. Expected ) Here
>>>>(ndraws=ndraws,<<<<
## I1. Expected Instruction - CD Is Not Recognizable As One
>>>> cd=<<<<

May you please give me a hint why I am not getting any results?

thank you.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Nord1 wrote:Dear Tom,

Thank you for posting the new procedure. There are a few points, I am following Primiceri (2005) original paper, which is replicated on https://estima.com/forum/viewtopic.php?f=5&t=781 and at the moment I am using the same data posted with the example. On pg. 29 of the non-published copy of the paper, Primiceri used Geweke measure as part of testing the convergence and the sensitivity test of the MCMC. Following Primiceri (2005), I want to focus on the convergence of V, Sigma,A, and B.
Therefore, I want to test the convergence of PiRes, Ares, LambdaRes, and SRes as following:

@gewekecd (ndraws=ndraws,mean=bmean,stderrs=bstderrs,$
cd=bcd,nse=bnse) PiRes Ares LambdaRes
report(action=define)
report(atrow=1,atcol=1,align=center) "Variable" "Coeff" "Std Error" $
"NSE" "CD"
do i=1,%nreg
report(row=new,atcol=1) "B","A","S",”V” +i bmean(i) bstderrs(i) bnse(i) bcd(i)
end do i
report(action=format,atcol=2,tocol=3,picture="*.###")
report(action=format,atcol=4,picture="*.##")
report(action=show)


I am getting the following error message:
## SX20. Expected ) Here
>>>>(ndraws=ndraws,<<<<
## I1. Expected Instruction - CD Is Not Recognizable As One
>>>> cd=<<<<

May you please give me a hint why I am not getting any results?

thank you.
@GEWEKECD is a completely different procedure from @MCMCPOSTPROC---you're trying to use the syntax from the latter. You would have to test the elements of PIRES, ARES, etc. one at a time. Something like

do i=1,%rows(pires)
@gewekecd pires(i)
end do i
...

As I said, there are a lot of series of parameters.
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

Dear Tom,

I am getting the following error message:

## SX20. Expected , Here
>>>>@gewekecd pires(i)<<<<
## SX21. A END or } Here is Unneeded or Unexpected
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Sorry. PIRES is a RECT[SERIES], not a VECTOR[SERIES], so it would be

Code: Select all

do i=1,%rows(pires)
   do j=1,%cols(pires)
      @gewekecd pires(i,j)
   end do j
end do i
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

dear Tom,

is calculating the autocorrelation between the draws as a test of how well Markov Chain mixes is equivalent to the autocorrelation in PiRes series?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Nord1 wrote:dear Tom,

is calculating the autocorrelation between the draws as a test of how well Markov Chain mixes is equivalent to the autocorrelation in PiRes series?
First, PiRes is only one part of the parameter set, and it may be relatively well-behaved while some other part isn't. Second, the usual checks for MC convergence look at behavior over much longer runs than a typical autocorrelation analysis.
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

Is the null hypothesis in Geweke test in the previous procedure the following: the two parts of the chain are asymptotically independent??

Rejecting the null means a bad estimation.

What is the point of taking the inverse of Geweke test as Primiceri (2005) in his paper (on pg. 29 in the unpublished version of the paper)??

is there a possibility to get Geweke plot?

Do you have any suggestions of how to test the MC convergence in more efficient way for the TVP-VAR?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Nord1 wrote:Is the null hypothesis in Geweke test in the previous procedure the following: the two parts of the chain are asymptotically independent??

Rejecting the null means a bad estimation.
The CD measure tests whether the ergodic nature of the chain appears to be holding. It doesn't test whether the beginning and end are independent---it assumes it. Instead, it's testing whether the mean at the start of the keeper draws is the same as the mean at the end (using robust estimates of the variance for the means). You could reject the null if you didn't do enough burn-in draws (so the starting subsample doesn't match the converged chain) or if the chain hasn't converged.
Nord1 wrote: What is the point of taking the inverse of Geweke test as Primiceri (2005) in his paper (on pg. 29 in the unpublished version of the paper)??
That's not based upon the CD measure---the IF is the inverse of the Geweke relative numerical efficiency measure.
Nord1 wrote: is there a possibility to get Geweke plot?
There really is no such thing. What Giorgio is showing is a plot of the measure with the 700 different parameters for which he is showing chain convergence measures. There's no good reason to show that as a line plot and it's not clear how it provides any information over and above the table of values.
Nord1 wrote: Do you have any suggestions of how to test the MC convergence in more efficient way for the TVP-VAR?
Not really. You can probably assume that the "hot spots" are the ones that had the lowest efficiency in the original work and concentrate on those. But for this size model, there are 700 of those.
Nord1
Posts: 10
Joined: Tue Apr 09, 2013 6:34 am

Re: TVP-VAR related issues

Unread post by Nord1 »

Dear Tom, I checked the form and I could not find codes example of how to calculate Geweke relative numerical efficiency measure; may you please give a hit of how to calculate it for "PIRES" as an example so we can calculate the IF??
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVP-VAR related issues

Unread post by TomDoan »

Nord1 wrote:Dear Tom, I checked the form and I could not find codes example of how to calculate Geweke relative numerical efficiency measure; may you please give a hit of how to calculate it for "PIRES" as an example so we can calculate the IF??
The inefficiency factor is the ratio of a Bartlett (Newey-West) estimate of the variance of a series (using a rather wide window) to the standard variance estimate. (The Geweke relative numerical efficiency is the ratio in the other order---the IF is easier to interpret).

diff(standardize) x / cx
mcov(lwindow=bartlett,lags=a lot)
# cx
disp "Chain inefficiency factor" %cmom(1,1)/%nobs

Primiceri's paper describes what "a lot" means in his case---it's a percentage of the number of draws.
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: TVP-VAR related issues

Unread post by ege_man »

Dear Nord1 and Tom,
Could you please share me the complete version of the codes to calculate Geweke measure to check robustness of the TVP-VAR results?
Thanks in advance.
Post Reply