Page 1 of 1

Rolling Bivariate VAR

Posted: Fri Aug 19, 2011 7:45 am
by walle1910
Hello,

I am trying to run a rolling bi-variate VAR regression as in Blanchard and Gali (2008): The Macroeconomic Effects Of Oil Price Shocks: Why Are The 2000s So Different From The 1970s?

I would like to obtain the graph of Impulse Response Functions in particular the effect of shocks oil prices on the real effective exchange rate as they evolve and I came up with the following code. However each time I run the code I get an error message that "ROLLIN is not defined in freeze (roliin) var.impulse(12, se=a) op @ cexr @ op cexr ". I would like help in this regard.

' =====================================================================
' SETUP
' =====================================================================

wfcreate(wf=r:\wts\mywork\period\period10) q 1975q1 2010q4 ' creates new WF
read(b2,s=rollreg) r:\wts\mywork\period\data.xls can_reec oilp_wti can_ngdp nor_reec nor_ngdp ' imports data from XLS

scalar window = 124 ' for 5 year data

genr l_oilp = log(oilp_wti) 'log of oil prices
genr oilp = d (l_oilp) 'log difference of oil prices


' =====================================================================
' CANADA
' =====================================================================

genr l_can_reec = log(can_reec) 'log of real effective exchange rate
genr cexr = d (l_can_reec) 'log difference of real effective exchange rate

genr l_can_ngdp = log(can_ngdp) 'log of Canandian Gross Domestic Product
genr cy = d (l_can_ngdp) 'log difference of Candian output

for !i = 1 to window

smpl 1975q1+!i 1979q4+!i

series op = oilp ' specification for OIL
series cexr = can_reec ' specification for EXCHANGE RATE

' VAR estimation
' -----------------------
var var.ls 1 2 op cexr
freeze (roliin) var.impulse(12, se=a) op @ cexr @ op cexr
var.makeresids error_op error_cexr

''VAR diagnostics
' ------------------------
freeze(Q_CAN_{!i}) var.qstats(8) ' a test for serial correlation
freeze(JB_CAN_{!i}) var.jbera(factor=chol) ' a test for normality
freeze(W_CAN_{!i}) var.white ' a test for heteroskedasticity

next

Re: Rolling Bivariate VAR

Posted: Fri Aug 19, 2011 7:56 am
by EViews Gareth

Code: Select all

freeze (roliin) var.impulse(12, se=a) op @ cexr @ op cexr
should be

Code: Select all

freeze(roliin) var.impulse(12, se=a) op @ cexr @ op cexr
(i.e. remove the space between the freeze command and the parenthesis.)

Re: Rolling Bivariate VAR

Posted: Fri Aug 19, 2011 8:09 am
by walle1910
Thanks Gareth it worked but came back with another error "ROLLIN already exists in freeze(rollin) var.impulse(12, se=a) op @ cexr @ op cexr"

Re: Rolling Bivariate VAR

Posted: Fri Aug 19, 2011 8:12 am
by EViews Gareth
That's somewhat self explanatory - you're trying to create an object called "Roliin", but there's already an object called that. You can use the mode=overwrite option of the freeze command to overwrite the existing object:

Code: Select all

freeze(mode=overwrite, roliin) var.impulse(12, se=a) op @ cexr @ op cexr

Re: Rolling Bivariate VAR

Posted: Fri Aug 19, 2011 8:19 am
by walle1910
Thanks Gareth :D