Page 2 of 4

Re: VAR with time-varying parameters and stochastic volatili

Posted: Wed Apr 10, 2013 2:28 pm
by tclark
In the literature (e.g., Cogley and Sargent 2005, Primiceri 2005), the standard approach is to allow the time variation in model coefficients pick up movements in means over time. In plenty of papers, mean shifts are a key reason for introducing time varying parameters.

Re: VAR with time-varying parameters and stochastic volatili

Posted: Thu May 02, 2013 12:57 pm
by tclark
Regarding the estimation procedure I originally posted, Del Negro and Primiceri (link below) have recent posted a correction to the ordering of Gibbs sampler steps detailed in the appendix to Primiceri (2005, RESTUD) and used in the original version of the code I posted a few years ago. This correction should reduce the tendency of the original code to produce very variable estimates of stochastic volatility. However, Del Negro and Primiceri report that the correction doesn't much affect the results reported in Primiceri (2005).

http://faculty.wcas.northwestern.edu/%7 ... aFinal.pdf

Re: VAR with time-varying parameters and stochastic volatili

Posted: Tue Nov 12, 2013 8:21 am
by viking76
Dear Todd,

is it possible to use your code to run a TVC panel VAR? Many thanks.

Best

Adrian

Re: VAR with time-varying parameters and stochastic volatili

Posted: Tue Nov 12, 2013 8:38 am
by tclark
Sorry, but I don't think so. The panel setup will normally involve imposing restrictions to make coefficients common across equations. The VAR setup of the code I provided doesn't allow that.

Re: VAR with time-varying parameters and stochastic volatili

Posted: Sat Jan 04, 2014 2:18 am
by istiak
Dear Todd
What does the following lines in the code mean?

"dofor i = pigdp

set(scratch) i stsmpl+1 endsmpl = 400.*log(i{0}/i{1})

end do i"

Are you taking annual growth rate of the inflation?
Thank you so much.
KI

Re: VAR with time-varying parameters and stochastic volatili

Posted: Sat Jan 04, 2014 7:41 am
by TomDoan
That replaces PIGDP with its annualized growth rate. Since PIGDP is the GDP deflator, the result would be the inflation rate.

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 06, 2014 9:53 am
by zipop
tclark wrote:Regarding the estimation procedure I originally posted, Del Negro and Primiceri (link below) have recent posted a correction to the ordering of Gibbs sampler steps detailed in the appendix to Primiceri (2005, RESTUD) and used in the original version of the code I posted a few years ago. This correction should reduce the tendency of the original code to produce very variable estimates of stochastic volatility. However, Del Negro and Primiceri report that the correction doesn't much affect the results reported in Primiceri (2005).

http://faculty.wcas.northwestern.edu/%7 ... aFinal.pdf
Dear Todd:

I am trying to run your TVP-VAR code on a 3 variable system and it is returning the following error message: NOT ENOUGH DATA IN TRAINING SAMPLE TO FIT PRIOR
but even when I use 70 time observations for the traning sample.

does this make sense because with your data you use 40 obs?

do you have an intuition for this problem?
thanks

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 06, 2014 10:00 am
by tclark
I would suggest printing out the data over the training sample and changing the display options to show the sample that is actually being used in the training sample estimation that is used to set the prior. While it is possible that there is some problem in the code, my first guess would be that the training sample doesn't have as many observations as you intend (and has less than 40 actually available).

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 06, 2014 10:53 am
by zipop
thanks
i check the data in the pre-sample and there seems to be no problem there. here are the files.

Re: VAR with time-varying parameters and stochastic volatili

Posted: Thu Jan 09, 2014 5:50 pm
by zipop
Hi Todd
I have not yet manage to find the cause of the error. But one thing that seems strage is that the presample results obtained directly from the code is different from the one that is derived from SCR file. I guess this may be related to the priors used? any intuition?
thanks
romain

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 13, 2014 1:24 am
by istiak
Dear Tom/Todd
When I run the code, I get 9 impulse responses in one picture for each time period 1975.01, 1981.03 and 1996.01. I need some more graphs. For example, how can I get a picture with 2 rows and 1 column when the a11 and a21 show response of PIGDP and UR respectively for a shock in ITB3M in 1975.01? I want to get the similar picture for 1981.03 and 1996.01 also. I tried by changing i, j, vfields and hfields numbers but was not successful. Can you please help me? Many thanks in advance.
KI

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 13, 2014 9:51 pm
by istiak
Dear Romain
As far as I can understand, your dataset is pretty smaller compared to the original dataset used to write the code. Thus though you use 40 observations for the prior, you need some more observations to make the prior. I changed "comp stpt = 1991:1" to "comp stpt = 1991:3". Then I used VARTVPKSC.src instead of VARTVPKSC.correctedMay2013.src (for some reason this corrected version does not work when I use it, I don't know why). Your code is now working fine.

I posted a problem yesterday. Do you know how to solve it? Regards.

KI

Re: VAR with time-varying parameters and stochastic volatili

Posted: Fri Jan 17, 2014 4:32 pm
by zipop
Dear KI,
thank you. actually i just solve the problem myself now before i see your post. The problem was related to the fact that i did not account for the number of lags when specifying the beginning of the estimation period. The way i did left 38 obs for the pre-sample whereas i explicily also put 40 obs for the pre-sample, something that was of course inconsistent. So the code is running proceed as follows: comp prenobs =40; comp stpt = 1991:4


Yes the new SCR return the following error message

## MAT15. Subscripts Too Large or Non-Positive
The Error Occurred At Location 7350, Line 472 of VARTVPKSC

Re: VAR with time-varying parameters and stochastic volatili

Posted: Fri Jan 24, 2014 5:15 am
by zipop
dear Tod
did you also experience the error message with the new SRC file VARTVPKSC.correctedMay2013.src?
it says "Subscripts Too Large or Non-Positive"
thanks

Re: VAR with time-varying parameters and stochastic volatili

Posted: Mon Jan 27, 2014 9:31 am
by tclark
I'm sorry for the problems. There was in fact an error in the procedure file in a failure to initialize the volatility draws before the Gibbs loop (it didn't show up when I first tested another version of the program for reasons no one cares to know). This version fixes the problem. In addition, the first error in running the program was due to not accounting for model lags in defining the number of observations for the training sample estimation. In your original program, given your available sample, prenobs needs to be defined as 40-fixlags.