I have a problem calculating spillover index proposed by diebold (2009) and the code is proposed by TomDoan.
I revised the code to estimate VECM. Because my data have a cointegration.
whenever I excute the problem, Rats program shotdown.(I.m rats 8.3 trial version user)
but If I delete
eigen(cvalues=cv) %modelcompanion(ectmodel)
if %cabs(cv(1))>=1.0 {
compute spillreturns(end)=%na
next
}
the program is excuted.
but I want to Skip any data points where the rolling VECM has an explosive root.
How Can I solve the problem?
I attached the code and data.
please help me.
Thanks regards.
Code: Select all
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(ectmodel)
if %cabs(cv(1))>=1.0 {
compute spillreturns(end)=%na
next
}
compute gfactor=FactorMatrix()
errors(model=ectmodel,steps=nsteps,factor=gfactor,stderrs=gstderrs,noprint,results=gfevd)
compute gfevdx=%xt(gfevd,nsteps)
ewise fromvar(i)=%sum(%xrow(gfevdx,i))-gfevdx(i,i)
ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
compute net = tovar - fromvar
compute spillreturns(end)=100.0*%sum(tovar)/%nvar
end do end
graph(footer="Spillover plot. Returns. 60 month window. 12 step horizon")
# spillreturns