Generalized Variance Decomposition with Constraints

Questions and discussions on Vector Autoregressions
Masafumi
Posts: 9
Joined: Wed May 09, 2012 12:48 pm

Generalized Variance Decomposition with Constraints

Unread post by Masafumi »

To Whom It May Concern,

I am trying to estimate generalized variance decompositions for a 7-variable VAR model, using the code replicating Diebold-Yilmaz EJ 2009 (http://www.estima.com/forum/viewtopic.p ... old+yilmaz).
The thing is that I need to put constraints on some of the coefficients in the equations, so that some variables (R_KEN, R_TZA, R_UGA, R_RWA, R_BDI) do not affect the other (R_USA, R_EUR).
I used %modelsetcoeffs and wrote the program pasted below; however, it seems not working.
The estimated decompositions only slightly differ from those without restrictions, and they do not conform to my expectation that variables with zero coefficients provide zero spillovers to the others.
When I try a simpler program using Cholesky decomposition (also pasted below), it gives me an expected result: zero spillover from variables with restrictions to the others.

I suppose it might be because calculated factor matrix (FactorMatrix) does not reflect the restrictions imposed.
But I could not figure out how I can deal with this.
Any help will be greatly appreciated. Thank you so much.

Best,

Masafumi

Code: Select all

*
* Replication file for Diebold and Yilmaz(2009),  "Measuring Financial
* Asset Return and Volatility Spillovers, with Application to Global
* Equity Markets," Economic Journal, vol. 119, no. 534, 158-171.
*
* Analysis of returns data
*
* 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=1
*
OPEN DATA NEER_EAC.XLS
CALENDAR(W) 2000:1:9
DATA(FORMAT=XLS,ORG=COLUMNS,LEFT=2,DATEFORM="m/d/y") 2000:01:09 2012:09:09 R_USA R_EUR R_KEN R_TZA R_UGA $
 R_RWA R_BDI

*
dec vect[int] returns
enter(varying) returns
# R_USA R_EUR R_KEN R_TZA R_UGA R_RWA R_BDI

dec vect[string] longlabels(%size(returns))
enter longlabels
# "U.S. Dollar" "Euro" "Kenya Shilling" "Tanzania Shilling" "Uganda Shilling" "Rwanda Franc" "Burundi Franc"
dec vect[string] shortlabels(%size(returns))
enter shortlabels
# "USA" "EUR" "KEN" "TZA" "UGA" "RWA" "BDI"
*
* Setup and estimate one lag VAR
*
system(model=returnvar)
variables returns
lags 1
det constant
end(system)
*
estimate

compute coeffs = %modelgetcoeffs(returnvar)
compute coeffs(3,1) = 0
compute coeffs(4,1) = 0
compute coeffs(5,1) = 0
compute coeffs(6,1) = 0
compute coeffs(7,1) = 0
compute coeffs(3,2) = 0
compute coeffs(4,2) = 0
compute coeffs(5,2) = 0
compute coeffs(6,2) = 0
compute coeffs(7,2) = 0
compute %modelsetcoeffs(returnvar, coeffs)

*
* Save the full estimation range for later use
*
compute rstart=%regstart(),rend=%regend()
*
* Compute variance decompositions up to 10 step and analyze the 4 step responses
*
compute nsteps=10
compute asteps=4
*********************************************************************
*
* 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,results=gfevd)
compute gfevdx=%xt(gfevd,asteps)
display "4-Step-Ahead Variance Decomposition" gfevdx

*
* These are for computing the contributions from others, to others and
* to others including own for each variable.
*
dec vect tovar(%nvar) fromvar(%nvar) tototal(%nvar)
ewise fromvar(i)=%sum(%xrow(gfevdx,i))-gfevdx(i,i)
ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
ewise tototal(i)=tovar(i)+1-fromvar(i)
compute spillover=100.0*%sum(tovar)/%nvar
*
report(action=define,title="Table [ ]. Spillover Table for EAC Currency Returns")
report(atrow=1,atcol=2,align=center,fillby=rows) shortlabels
report(atrow=2,atcol=1,fillby=cols) shortlabels
report(atrow=2,atcol=2) 100.0*gfevdx
report(atrow=%nvar+2,atcol=1,fillby=rows) "Contribution to others" 100.0*tovar
report(atrow=%nvar+3,atcol=1,fillby=rows) "Contribution including own" 100.0*tototal
report(atcol=%nvar+2,atrow=1) "From Others"
report(atcol=%nvar+2,atrow=2,fillby=cols) 100.0*fromvar
report(atrow=%nvar+2,atcol=%nvar+2,fillby=cols) 100.0*%sum(tovar)
report(atrow=%nvar+3,atcol=%nvar+2,align=right) %strval(spillover,"##.#")+"%"
report(atrow=2,atcol=2,torow=%nvar+3,tocol=%nvar+2,action=format,picture="*.#")
report(action=show)
*
* Rolling window analysis
*
compute nspan=200
set spillreturns rstart+nspan-1 rend = 0.0
set from1to1 rstart+nspan-1 rend = 0.0
set from2to1 rstart+nspan-1 rend = 0.0
set from3to1 rstart+nspan-1 rend = 0.0
set from4to1 rstart+nspan-1 rend = 0.0
set from5to1 rstart+nspan-1 rend = 0.0
set from6to1 rstart+nspan-1 rend = 0.0
set from7to1 rstart+nspan-1 rend = 0.0
set from1to2 rstart+nspan-1 rend = 0.0
set from2to2 rstart+nspan-1 rend = 0.0
set from3to2 rstart+nspan-1 rend = 0.0
set from4to2 rstart+nspan-1 rend = 0.0
set from5to2 rstart+nspan-1 rend = 0.0
set from6to2 rstart+nspan-1 rend = 0.0
set from7to2 rstart+nspan-1 rend = 0.0
set from1to3 rstart+nspan-1 rend = 0.0
set from2to3 rstart+nspan-1 rend = 0.0
set from3to3 rstart+nspan-1 rend = 0.0
set from4to3 rstart+nspan-1 rend = 0.0
set from5to3 rstart+nspan-1 rend = 0.0
set from6to3 rstart+nspan-1 rend = 0.0
set from7to3 rstart+nspan-1 rend = 0.0
set from1to4 rstart+nspan-1 rend = 0.0
set from2to4 rstart+nspan-1 rend = 0.0
set from3to4 rstart+nspan-1 rend = 0.0
set from4to4 rstart+nspan-1 rend = 0.0
set from5to4 rstart+nspan-1 rend = 0.0
set from6to4 rstart+nspan-1 rend = 0.0
set from7to4 rstart+nspan-1 rend = 0.0
set from1to5 rstart+nspan-1 rend = 0.0
set from2to5 rstart+nspan-1 rend = 0.0
set from3to5 rstart+nspan-1 rend = 0.0
set from4to5 rstart+nspan-1 rend = 0.0
set from5to5 rstart+nspan-1 rend = 0.0
set from6to5 rstart+nspan-1 rend = 0.0
set from7to5 rstart+nspan-1 rend = 0.0
set from1to6 rstart+nspan-1 rend = 0.0
set from2to6 rstart+nspan-1 rend = 0.0
set from3to6 rstart+nspan-1 rend = 0.0
set from4to6 rstart+nspan-1 rend = 0.0
set from5to6 rstart+nspan-1 rend = 0.0
set from6to6 rstart+nspan-1 rend = 0.0
set from7to6 rstart+nspan-1 rend = 0.0
set from1to7 rstart+nspan-1 rend = 0.0
set from2to7 rstart+nspan-1 rend = 0.0
set from3to7 rstart+nspan-1 rend = 0.0
set from4to7 rstart+nspan-1 rend = 0.0
set from5to7 rstart+nspan-1 rend = 0.0
set from6to7 rstart+nspan-1 rend = 0.0
set from7to7 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,asteps)
   ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
   compute spillreturns(end)=100.0*%sum(tovar)/%nvar
	compute from1to1(end)=gfevdx(1,1)*100
	compute from2to1(end)=gfevdx(1,2)*100
	compute from3to1(end)=gfevdx(1,3)*100
	compute from4to1(end)=gfevdx(1,4)*100
	compute from5to1(end)=gfevdx(1,5)*100
	compute from6to1(end)=gfevdx(1,6)*100
	compute from7to1(end)=gfevdx(1,7)*100
	compute from1to2(end)=gfevdx(2,1)*100
	compute from2to2(end)=gfevdx(2,2)*100
	compute from3to2(end)=gfevdx(2,3)*100
	compute from4to2(end)=gfevdx(2,4)*100
	compute from5to2(end)=gfevdx(2,5)*100
	compute from6to2(end)=gfevdx(2,6)*100
	compute from7to2(end)=gfevdx(2,7)*100
	compute from1to3(end)=gfevdx(3,1)*100
	compute from2to3(end)=gfevdx(3,2)*100
	compute from3to3(end)=gfevdx(3,3)*100
	compute from4to3(end)=gfevdx(3,4)*100
	compute from5to3(end)=gfevdx(3,5)*100
	compute from6to3(end)=gfevdx(3,6)*100
	compute from7to3(end)=gfevdx(3,7)*100
	compute from1to4(end)=gfevdx(4,1)*100
	compute from2to4(end)=gfevdx(4,2)*100
	compute from3to4(end)=gfevdx(4,3)*100
	compute from4to4(end)=gfevdx(4,4)*100
	compute from5to4(end)=gfevdx(4,5)*100
	compute from6to4(end)=gfevdx(4,6)*100
	compute from7to4(end)=gfevdx(4,7)*100
	compute from1to5(end)=gfevdx(5,1)*100
	compute from2to5(end)=gfevdx(5,2)*100
	compute from3to5(end)=gfevdx(5,3)*100
	compute from4to5(end)=gfevdx(5,4)*100
	compute from5to5(end)=gfevdx(5,5)*100
	compute from6to5(end)=gfevdx(5,6)*100
	compute from7to5(end)=gfevdx(5,7)*100
	compute from1to6(end)=gfevdx(6,1)*100
	compute from2to6(end)=gfevdx(6,2)*100
	compute from3to6(end)=gfevdx(6,3)*100
	compute from4to6(end)=gfevdx(6,4)*100
	compute from5to6(end)=gfevdx(6,5)*100
	compute from6to6(end)=gfevdx(6,6)*100
	compute from7to6(end)=gfevdx(6,7)*100
	compute from1to7(end)=gfevdx(7,1)*100
	compute from2to7(end)=gfevdx(7,2)*100
	compute from3to7(end)=gfevdx(7,3)*100
	compute from4to7(end)=gfevdx(7,4)*100
	compute from5to7(end)=gfevdx(7,5)*100
	compute from6to7(end)=gfevdx(7,6)*100
	compute from7to7(end)=gfevdx(7,7)*100

end do end
graph(footer="Spillover plot. Returns. 200 week window. 4 step horizon")
# spillreturns

open copy VD_EAC.xls
copy(dates,format=xls,org=columns)
Simple program with/without constraints

Code: Select all

OPEN DATA NEER_EAC.XLS
CALENDAR(W) 2000:1:9
DATA(FORMAT=XLS,ORG=COLUMNS,LEFT=2,DATEFORM="m/d/y") 2000:01:09 2012:09:09 R_USA R_EUR R_KEN R_TZA R_UGA $
 R_RWA R_BDI

* --------------------------------------------------------------------------
* Without Restrictions on Coefficients
* --------------------------------------------------------------------------

dec vect[int] returns
enter(varying) returns
# R_USA R_EUR R_KEN R_TZA R_UGA R_RWA R_BDI

* Setup and estimate one lag VAR
system(model=returnvar)
variables returns
lags 1
det constant
end(system)
estimate

* Compute variance decompositions up to 10 step and analyze the 4 step responses
errors(model=returnvar,steps=10,cv=%sigma,stderrs=gstderrs1,results=gfevd1)
compute gfevdx1=%xt(gfevd1,4)
display "4-Step-Ahead Variance Decomposition" gfevdx1

* --------------------------------------------------------------------------
* Coefficients Restricted
* --------------------------------------------------------------------------
compute coeffs = %modelgetcoeffs(returnvar)
compute coeffs(3,1) = 0
compute coeffs(4,1) = 0
compute coeffs(5,1) = 0
compute coeffs(6,1) = 0
compute coeffs(7,1) = 0
compute coeffs(3,2) = 0
compute coeffs(4,2) = 0
compute coeffs(5,2) = 0
compute coeffs(6,2) = 0
compute coeffs(7,2) = 0
compute %modelsetcoeffs(returnvar, coeffs)

* Compute variance decompositions up to 10 step and analyze the 4 step responses
errors(model=returnvar,steps=10,cv=%sigma,stderrs=gstderrs2,results=gfevd2)
compute gfevdx2=%xt(gfevd2,4)
display "4-Step-Ahead Variance Decomposition" gfevdx2
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Generalized Variance Decomposition with Constraints

Unread post by TomDoan »

There's nothing about the Diebold-Yilmaz calculations that require a fully populated VAR. Just set up the model as a near-VAR (RATS v8 User's Guide, section 7.9). Everything from estimation on will be the same.
Masafumi
Posts: 9
Joined: Wed May 09, 2012 12:48 pm

Re: Generalized Variance Decomposition with Constraints

Unread post by Masafumi »

Dear Tom,

Thank you so much for your quick reply. I deeply appreciate it.
Following your advice, I constructed a near-VAR as follows.

Code: Select all

* Setup and estimate one lag VAR
*
system(model=ADV)
variables R_USA R_EUR
lags 1
det constant
end(system)
system(model=EAC)
variables R_KEN R_TZA R_UGA R_RWA R_BDI
lags 1
det constant R_USA{1 to 1} R_EUR{1 to 1}
end(system)
compute returnvar=ADV+EAC

estimate(model=returnvar)
It gives me a VAR model as I wanted; however, resulting decompositions are exactly the same as those from my previous program, which used %modelsetcoeffs.
Variables that are not included in the equations for R_USA and R_EUR still generate spillovers to R_USA and R_EUR.
Could you please advise me how I can avoid this?

Thank you so much,

Masafumi

Full Program

Code: Select all

*
* Replication file for Diebold and Yilmaz(2009),  "Measuring Financial
* Asset Return and Volatility Spillovers, with Application to Global
* Equity Markets," Economic Journal, vol. 119, no. 534, 158-171.
*
* Analysis of returns data
*
* 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=1
*
OPEN DATA "\\data4\users10\MYabara\My Documents\Research\Spillovers\Analysis\VD\NEER_EAC.XLS"
CALENDAR(W) 2000:1:9
DATA(FORMAT=XLS,ORG=COLUMNS,LEFT=2,DATEFORM="m/d/y") 2000:01:09 2012:09:09 R_USA R_EUR R_KEN R_TZA R_UGA $
 R_RWA R_BDI

*
dec vect[int] returns
enter(varying) returns
# R_USA R_EUR R_KEN R_TZA R_UGA R_RWA R_BDI

dec vect[string] longlabels(%size(returns))
enter longlabels
# "U.S. Dollar" "Euro" "Kenya Shilling" "Tanzania Shilling" "Uganda Shilling" "Rwanda Franc" "Burundi Franc"
dec vect[string] shortlabels(%size(returns))
enter shortlabels
# "USA" "EUR" "KEN" "TZA" "UGA" "RWA" "BDI"
*
* Setup and estimate one lag VAR
*
system(model=ADV)
variables R_USA R_EUR
lags 1
det constant
end(system)
system(model=EAC)
variables R_KEN R_TZA R_UGA R_RWA R_BDI
lags 1
det constant R_USA{1 to 1} R_EUR{1 to 1}
end(system)
compute returnvar=ADV+EAC

estimate(model=returnvar)

*
* Save the full estimation range for later use
*
compute rstart=%regstart(),rend=%regend()
*
* Compute variance decompositions up to 10 step and analyze the 4 step responses
*
compute nsteps=10
compute asteps=4
*********************************************************************
*
* 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,results=gfevd)
compute gfevdx=%xt(gfevd,asteps)
display "4-Step-Ahead Variance Decomposition" gfevdx

*
* These are for computing the contributions from others, to others and
* to others including own for each variable.
*
dec vect tovar(%nvar) fromvar(%nvar) tototal(%nvar)
ewise fromvar(i)=%sum(%xrow(gfevdx,i))-gfevdx(i,i)
ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
ewise tototal(i)=tovar(i)+1-fromvar(i)
compute spillover=100.0*%sum(tovar)/%nvar
*
report(action=define,title="Table [ ]. Spillover Table for EAC Currency Returns")
report(atrow=1,atcol=2,align=center,fillby=rows) shortlabels
report(atrow=2,atcol=1,fillby=cols) shortlabels
report(atrow=2,atcol=2) 100.0*gfevdx
report(atrow=%nvar+2,atcol=1,fillby=rows) "Contribution to others" 100.0*tovar
report(atrow=%nvar+3,atcol=1,fillby=rows) "Contribution including own" 100.0*tototal
report(atcol=%nvar+2,atrow=1) "From Others"
report(atcol=%nvar+2,atrow=2,fillby=cols) 100.0*fromvar
report(atrow=%nvar+2,atcol=%nvar+2,fillby=cols) 100.0*%sum(tovar)
report(atrow=%nvar+3,atcol=%nvar+2,align=right) %strval(spillover,"##.#")+"%"
report(atrow=2,atcol=2,torow=%nvar+3,tocol=%nvar+2,action=format,picture="*.#")
report(action=show)
*
* Rolling window analysis
*
compute nspan=200
set spillreturns rstart+nspan-1 rend = 0.0
set from1to1 rstart+nspan-1 rend = 0.0
set from2to1 rstart+nspan-1 rend = 0.0
set from3to1 rstart+nspan-1 rend = 0.0
set from4to1 rstart+nspan-1 rend = 0.0
set from5to1 rstart+nspan-1 rend = 0.0
set from6to1 rstart+nspan-1 rend = 0.0
set from7to1 rstart+nspan-1 rend = 0.0
set from1to2 rstart+nspan-1 rend = 0.0
set from2to2 rstart+nspan-1 rend = 0.0
set from3to2 rstart+nspan-1 rend = 0.0
set from4to2 rstart+nspan-1 rend = 0.0
set from5to2 rstart+nspan-1 rend = 0.0
set from6to2 rstart+nspan-1 rend = 0.0
set from7to2 rstart+nspan-1 rend = 0.0
set from1to3 rstart+nspan-1 rend = 0.0
set from2to3 rstart+nspan-1 rend = 0.0
set from3to3 rstart+nspan-1 rend = 0.0
set from4to3 rstart+nspan-1 rend = 0.0
set from5to3 rstart+nspan-1 rend = 0.0
set from6to3 rstart+nspan-1 rend = 0.0
set from7to3 rstart+nspan-1 rend = 0.0
set from1to4 rstart+nspan-1 rend = 0.0
set from2to4 rstart+nspan-1 rend = 0.0
set from3to4 rstart+nspan-1 rend = 0.0
set from4to4 rstart+nspan-1 rend = 0.0
set from5to4 rstart+nspan-1 rend = 0.0
set from6to4 rstart+nspan-1 rend = 0.0
set from7to4 rstart+nspan-1 rend = 0.0
set from1to5 rstart+nspan-1 rend = 0.0
set from2to5 rstart+nspan-1 rend = 0.0
set from3to5 rstart+nspan-1 rend = 0.0
set from4to5 rstart+nspan-1 rend = 0.0
set from5to5 rstart+nspan-1 rend = 0.0
set from6to5 rstart+nspan-1 rend = 0.0
set from7to5 rstart+nspan-1 rend = 0.0
set from1to6 rstart+nspan-1 rend = 0.0
set from2to6 rstart+nspan-1 rend = 0.0
set from3to6 rstart+nspan-1 rend = 0.0
set from4to6 rstart+nspan-1 rend = 0.0
set from5to6 rstart+nspan-1 rend = 0.0
set from6to6 rstart+nspan-1 rend = 0.0
set from7to6 rstart+nspan-1 rend = 0.0
set from1to7 rstart+nspan-1 rend = 0.0
set from2to7 rstart+nspan-1 rend = 0.0
set from3to7 rstart+nspan-1 rend = 0.0
set from4to7 rstart+nspan-1 rend = 0.0
set from5to7 rstart+nspan-1 rend = 0.0
set from6to7 rstart+nspan-1 rend = 0.0
set from7to7 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,asteps)
   ewise tovar(i)=%sum(%xcol(gfevdx,i))-gfevdx(i,i)
   compute spillreturns(end)=100.0*%sum(tovar)/%nvar
	compute from1to1(end)=gfevdx(1,1)*100
	compute from2to1(end)=gfevdx(1,2)*100
	compute from3to1(end)=gfevdx(1,3)*100
	compute from4to1(end)=gfevdx(1,4)*100
	compute from5to1(end)=gfevdx(1,5)*100
	compute from6to1(end)=gfevdx(1,6)*100
	compute from7to1(end)=gfevdx(1,7)*100
	compute from1to2(end)=gfevdx(2,1)*100
	compute from2to2(end)=gfevdx(2,2)*100
	compute from3to2(end)=gfevdx(2,3)*100
	compute from4to2(end)=gfevdx(2,4)*100
	compute from5to2(end)=gfevdx(2,5)*100
	compute from6to2(end)=gfevdx(2,6)*100
	compute from7to2(end)=gfevdx(2,7)*100
	compute from1to3(end)=gfevdx(3,1)*100
	compute from2to3(end)=gfevdx(3,2)*100
	compute from3to3(end)=gfevdx(3,3)*100
	compute from4to3(end)=gfevdx(3,4)*100
	compute from5to3(end)=gfevdx(3,5)*100
	compute from6to3(end)=gfevdx(3,6)*100
	compute from7to3(end)=gfevdx(3,7)*100
	compute from1to4(end)=gfevdx(4,1)*100
	compute from2to4(end)=gfevdx(4,2)*100
	compute from3to4(end)=gfevdx(4,3)*100
	compute from4to4(end)=gfevdx(4,4)*100
	compute from5to4(end)=gfevdx(4,5)*100
	compute from6to4(end)=gfevdx(4,6)*100
	compute from7to4(end)=gfevdx(4,7)*100
	compute from1to5(end)=gfevdx(5,1)*100
	compute from2to5(end)=gfevdx(5,2)*100
	compute from3to5(end)=gfevdx(5,3)*100
	compute from4to5(end)=gfevdx(5,4)*100
	compute from5to5(end)=gfevdx(5,5)*100
	compute from6to5(end)=gfevdx(5,6)*100
	compute from7to5(end)=gfevdx(5,7)*100
	compute from1to6(end)=gfevdx(6,1)*100
	compute from2to6(end)=gfevdx(6,2)*100
	compute from3to6(end)=gfevdx(6,3)*100
	compute from4to6(end)=gfevdx(6,4)*100
	compute from5to6(end)=gfevdx(6,5)*100
	compute from6to6(end)=gfevdx(6,6)*100
	compute from7to6(end)=gfevdx(6,7)*100
	compute from1to7(end)=gfevdx(7,1)*100
	compute from2to7(end)=gfevdx(7,2)*100
	compute from3to7(end)=gfevdx(7,3)*100
	compute from4to7(end)=gfevdx(7,4)*100
	compute from5to7(end)=gfevdx(7,5)*100
	compute from6to7(end)=gfevdx(7,6)*100
	compute from7to7(end)=gfevdx(7,7)*100

end do end
graph(footer="Spillover plot. Returns. 200 week window. 4 step horizon")
# spillreturns

open copy VD_EAC.xls
copy(dates,format=xls,org=columns)

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

Re: Generalized Variance Decomposition with Constraints

Unread post by TomDoan »

The whole point of the Generalized Variance Decomposition/GIRF is not to put a semi-structural model on the contemporaneous covariance matrix, but to treat every variable symmetrically. That's the reason you get spillovers from all to all. If you want a more structural model, then you can't use GIRF's and you'll have to figure out what calculation you actually want.
Masafumi
Posts: 9
Joined: Wed May 09, 2012 12:48 pm

Re: Generalized Variance Decomposition with Constraints

Unread post by Masafumi »

Dear Tom,

Thank you so much for your clear explanation.
Then I should try a structural VAR, right?

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

Re: Generalized Variance Decomposition with Constraints

Unread post by TomDoan »

Not necessarily. You need to come up with a different definition for the spillover measures.
Masafumi
Posts: 9
Joined: Wed May 09, 2012 12:48 pm

Re: Generalized Variance Decomposition with Constraints

Unread post by Masafumi »

Could you elaborate a little bit more on the "different definition"?
I just wanted to measure spillovers as defined by Diebold-Yilmaz, but under a restriction that small economies do not generate spillovers to large ones.
It went perfectly well for Cholesky decomposition, as I posted before, but not for generalized.
I am not entirely sure why, since the generalized method just computes shocks with each variable being first in a Cholesky order.
Shocks to small economies should not affect large economies as long as small economies' coefficients are zero in equations for the large economies.

I sincerely appreciate your help.

Best,

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

Re: Generalized Variance Decomposition with Constraints

Unread post by TomDoan »

The Diebold-Yilmaz definition of spillover uses a generalized variance decomposition. If you feed in a different "factorization" (note that the GIRF matrix isn't actually a factorization), you are computing something different from their definition. A Cholesky factor will have the side effect of restricting the spillovers from the last variable to the others in its group---it won't be forced zero because of the lags, but won't be the same as what you would get from the generalized calculation.
Masafumi
Posts: 9
Joined: Wed May 09, 2012 12:48 pm

Re: Generalized Variance Decomposition with Constraints

Unread post by Masafumi »

I get your point--I need to think about a factorization that is suitable for my model.
Thank you so much for kindness and a series of guidance.

All the best,

Masafumi
Post Reply