Page 2 of 2
Re: VAR with time-varying parameters and stochastic volatili

Posted:
Sun Feb 17, 2013 7:31 am
by Andy_T
Dear Todd,
in VARTVPKSC.src, STEP 4: Draw {select_draw_1,....,select_draw_T}, the states used in the KSC mixture distribution - could you please tell me why we have to divide by sqrt(var_mixdist(i)) in line 4 of the following loop?
do ii = 1,nvar
do vtime=stpt,endpt
ewise tempinside(i) = (ystar2mat(vtime)(ii) - (2.*deltadraw(vtime)(ii) + mean_mixdist(i)))/sqrt(var_mixdist(i))
ewise tempdensity(i) = %density(tempinside(i))/sqrt(var_mixdist(i))
comp selection = pr_mixdist.*tempdensity
comp select_draw(vtime)(ii) = %ranbranch(selection)
end do vtime
end do ii
I tried looking up how %density calculates the standard normal density but I could not find the answer in the manuals. If the standard normal density is defined as:
1/sqrt(2*pi*sigma^2)*exp(-.5*((x - mu)^2)/sigma^2)
and I feed %density with (x - mu)/sigma, i.e. tempinside(i), what does %density give me?
Thanks in advance!
Re: VAR with time-varying parameters and stochastic volatili

Posted:
Tue Feb 19, 2013 8:55 am
by tclark
We need to compute the density value for a normal random variable. The textbook formula for that value is (sigma^2*2*pi)*exp(-1*(x-mu)^2/(2*sigma^2)), where mu and sigma denote the mean and st. dev. of x. The %density function is specific to a standard normal random variable, which means it imposes sigma = 1 and mu = 0. In the calculations in the code, the "tempinside" vector contains the term corresponding to (x-mu)/sigma. The value of %density((x-mu)/sigma) then has to be divided by sigma to deliver the correct value of the density of x.
Re: VAR with time-varying parameters and stochastic volatili

Posted:
Wed Mar 27, 2013 10:59 am
by luching
I am visiting this topic after a while. The codes by Todd or more generally the DLM routine in RATS use the Durbin-Koopman instead of Carter-Kohn to draw the states. I was just wondering if there are any specific advantages for doing so.
Re: VAR with time-varying parameters and stochastic volatili

Posted:
Wed Mar 27, 2013 12:43 pm
by moderator
luching wrote:I am visiting this topic after a while. The codes by Todd or more generally the DLM routine in RATS use the Durbin-Koopman instead of Carter-Kohn to draw the states. I was just wondering if there are any specific advantages for doing so.
They are distinct algorithms for doing the same type of draw, so either is OK. The advantage of D-K is that it is quite a bit simpler once you have written code for Kalman filtering and smoothing, while Carter-Kohn is a completely separate set of calculations.
Re: VAR with time-varying parameters and stochastic volatili

Posted:
Wed Apr 10, 2013 1:27 pm
by luching
With an intercept term in the VAR system, the time varying VAR model should be able to handle trends in the data because the time varying intercept term takes care of the trend. For instance, US inflation and nominal rate have an obvious downward trend. But from a stationarity standpoint, it looks like the data must be de-trended.
Any advice on this?
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