Generalized IRF (give a shock to specific variables)

Questions and discussions on Vector Autoregressions
akdeniz_coskun
Posts: 5
Joined: Thu May 01, 2014 10:17 am

Generalized IRF (give a shock to specific variables)

Unread post by akdeniz_coskun »

Dear Tom,
This is my first post in this forum and I am not so familiar with the procedures in Rats.
My main objective is to compute generalized IRF’s with following code.
The dataset has 14 variables that one of them is IP.
I try to give one unit of shock to each variables (expect IP), in order to get cumulative responses of IP to the shocks.
When I run the following code, I get responses of all varibles (in this case I also give a shock to IP).
How can I give a shock of all variables by excluding IP ?

I also try to declare shocklabels and varlabels, but it doesn’t work.
Regards.

Code: Select all

compute nstep = 24
source mcvardodraws3.src
calendar(m) 1992:1
allocate 2013:11
open data 03_05_2015.xls
data(format=xls,org=columns) / IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
table
******************************************************************
@VARLAGSELECT(LAGS=13,CRIT=AIC)
# IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
******************************************************************
system(model=FKE)
variables IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
lags 1 2
det constant
end(system)
estimate(noprint,resids=varresids)
errors(model=FKE, window="Variance Decomposition(Linear VAR)", steps=24)
******************************************************************
impulse(model=FKE, window="Impulse Responses", steps=24)
@MCVARDoDraws3(model=FKE, steps=24, draws=1000, accumulate=||1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14||)
@MCGraphIRF(model=FKE, page=all, STDEV=1.0, include=||1||)
Attachments
mcvardodraws3.src
(3.72 KiB) Downloaded 933 times
generalized IRF.RPF
(1.01 KiB) Downloaded 944 times
03_05_2015.xls
(105 KiB) Downloaded 610 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Generalized IRF (give a shock to specific variables)

Unread post by TomDoan »

That's relatively simple with version 9 which will allow you to use the "stock" @MCVARDODraws, but override with a "factor" function which gives a reduced set of shocks. (BTW, you don't have to accumulate the other variables since you don't want to do anything with their responses anyway). You definitely don't want PAGE=ALL, because that will do 13 panes all in one row. PAGE=BYVARIABLE with 3 or 4 for the number of columns is the best way to format that onto a single page.

With version 8, you would need to use @MCPROCESSIRF rather than @MCGRAPHIRF to get the responses and bounds and format the graphs yourself.

Code: Select all

function xgirf sigma model
type rect xgirf
type symm sigma
type model model
*
local rect fullgirf
compute fullgirf=%ddivide(sigma,%sqrt(%xdiag(sigma)))
compute xgirf=%xsubmat(fullgirf,1,14,2,14)
end
*
@MCVARDoDraws(model=FKE,ffunction=xgirf,steps=24,draws=100,accumulate=||1||)
@MCGraphIRF(model=FKE,STDEV=1.0,include=||1||,page=byvariable,columns=3,$
  shocklabels=||"CPI","REER","DEPOSIT","ISE","CREDIT","CONFIDENCE","DI","M1","FSPREAD","SSPREAD","OIL","VIX","SP500"||)
akdeniz_coskun
Posts: 5
Joined: Thu May 01, 2014 10:17 am

Re: Generalized IRF (give a shock to specific variables)

Unread post by akdeniz_coskun »

Dear Tom,
Thank you so much for your time,

When I use following code which you sent it, RATS reports a mistake as
## OP3. This Instruction Does Not Have An Option FFU>>>>odel=FKE,ffunction=<<<<

Is it possible to give me some more advice about the code? Thanks for your support.
Regards

Code: Select all

compute nstep = 24
source mcvardodraws.src
calendar(m) 1992:1
allocate 2013:11
open data 03_05_2015.xls
data(format=xls,org=columns) / IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
table
******************************************************************
@VARLAGSELECT(LAGS=15,CRIT=AIC)
# IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
*****************************************************
system(model=FKE)
variables IP CPI REER DEPOSIT ISE CREDIT CONFIDENCE DI M1 FSPREAD SSPREAD OIL VIX SP500
lags 1 2
det constant
end(system)
estimate(noprint,resids=varresids)
errors(model=FKE, window="Variance Decomposition(Linear VAR)", steps=24)
*****************************************************
function xgirf sigma model
type rect xgirf
type symm sigma
type model model
*
local rect fullgirf
compute fullgirf=%ddivide(sigma,%sqrt(%xdiag(sigma)))
compute xgirf=%xsubmat(fullgirf,1,14,2,14)
end
*
@MCVARDoDraws(model=FKE,ffunction=xgirf,steps=24,draws=100,accumulate=||1||)
@MCGraphIRF(model=FKE,STDEV=1.0,include=||1||,page=byvariable,columns=3,$
  shocklabels=||"CPI","REER","DEPOSIT","ISE","CREDIT","CONFIDENCE","DI","M1","FSPREAD","SSPREAD","OIL","VIX","SP500"||)
Attachments
updated_code.RPF
(1.23 KiB) Downloaded 910 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Generalized IRF (give a shock to specific variables)

Unread post by TomDoan »

The simplification to @MCVARDODRAWS by using the FFUNCTION option comes in version 9. With version 8, you need to create a custom version of @MCVARDODRAWS to handle the non-standard factorization.
Post Reply