Page 1 of 1

Diebold and Yilmaz Replication Code Issues

Posted: Wed Oct 28, 2015 3:56 pm
by countryrisk123
Hello,

I am working on some research in country spillovers and we have been using the RATS replication code to build our own index.

The replication code is found here: https://estima.com/procs_perl/mainproclistwrapper.shtml
Under deiboldyilmaz_ej2009

An issue we have is that the 2008 paper: Measuring Financial Asset Returns and Volatility Spillovers... linked here:
http://www.nber.org/papers/w13811.pdf
calculates a spillover index using a formula that was pointed out to be incorrect in this document in July 2010:
http://onlinelibrary.wiley.com/doi/10.1 ... 6_1.x/full

My question is: Does the replication code account for the correction? And if not how would we be able to fix the error?

Here is the code with some unnecessary parts removed to save space. Please let me know if more is needed. Thank you.

Code: Select all

*
* If you make usegirf=1, this will use the generalized spillover
* measures proposed in Diebold and Yilmaz(2011), "Better to Give than to
* Receive: Predictive Directional Measurement of Volatility Spillovers",
* IJF, to appear. usegirf=0 does the Choleski factorization used in the
* 2009 paper.
*
compute usegirf=0
*
dec vect[int] returns
* Setup and estimate two lag VAR
*
system(model=returnvar)
variables returns
lags 1 2
det constant
end(system)
*
estimate(noprint)
*
* Save the full estimation range for later use
*
compute rstart=%regstart(),rend=%regend()
*
* Analyze the 10 step responses
compute nsteps=10
*
* Produce the appropriate "factor" matrix from %sigma
*
function FactorMatrix
type rect FactorMatrix
if usegirf
   compute FactorMatrix=%sigma*inv(%diag(%sqrt(%xdiag(%sigma))))
else
   compute FactorMatrix=%decomp(%sigma)
end

compute gfactor=FactorMatrix()
*
errors(model=returnvar,steps=nsteps,factor=gfactor,stderrs=gstderrs,noprint,results=gfevd)
compute gfevdx=%xt(gfevd,nsteps)

* Rolling window analysis
*
compute nspan=200
set spillreturns rstart+nspan-1 rend = 0.0
do end=rstart+nspan-1,rend
   estimate(noprint) end-nspan+1 end
   *
   * Skip any data points where the rolling VAR has an explosive root.
   *
   eigen(cvalues=cv) %modelcompanion(returnvar)
   if %cabs(cv(1))>=1.0 {
      compute spillreturns(end)=%na
      next
   }
   compute gfactor=FactorMatrix()
   errors(model=returnvar,steps=nsteps,factor=gfactor,stderrs=gstderrs,noprint,results=gfevd)
   compute gfevdx=%xt(gfevd,nsteps)
   ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
   compute spillreturns(end)=100.0*%sum(tovar)/%nvar
end do end
graph(footer="Spillover plot. Returns. 200 week window. 10 step horizon")
# spillreturns

Re: Diebold and Yilmaz Replication Code Issues

Posted: Wed Oct 28, 2015 4:17 pm
by TomDoan
countryrisk123 wrote:Hello,

I am working on some research in country spillovers and we have been using the RATS replication code to build our own index.

The replication code is found here: https://estima.com/procs_perl/mainproclistwrapper.shtml
Under deiboldyilmaz_ej2009

An issue we have is that the 2008 paper: Measuring Financial Asset Returns and Volatility Spillovers... linked here:
http://www.nber.org/papers/w13811.pdf
calculates a spillover index using a formula that was pointed out to be incorrect in this document in July 2010:
http://onlinelibrary.wiley.com/doi/10.1 ... 6_1.x/full

My question is: Does the replication code account for the correction? And if not how would we be able to fix the error?
If you read the correction, the formulas in the original paper were written wrong but the results were correct. The RATS programs also do the calculations correctly. (We never used the formulas in the paper, since they just describe how to compute an FEVD).