VAR using long run identifying retrictions

Questions and discussions on Vector Autoregressions
RK2509
Posts: 30
Joined: Wed Apr 15, 2015 3:16 pm

VAR using long run identifying retrictions

Unread post by RK2509 »

Hi,

I am trying to use the long run identification strategy as in Stock and Watson (2005) and Lastrapes (Economic Letters 2005) , "Estimating and identifying vector autoregressions under diagonality and block exogeneity restrictions"

I am trying to look at the impact of money supply shocks on food price in India. I have a vector z_t = [z1_t, z2_t].
Now the first z1_t is basically how food price depends on its own lags and lags of all macro variables. z2_t is a vector of macro variables, how macro variables depend only on its own lags and not lags of food price.(block exogeniety)
z2_t has all the macro variables (GDP, INTEREST RATE, REAL MONEY NOMINAL MONEY). I have used the long run identifying restriction on the macro sub system.
I have done a cholesky decomposition of the D(1) matrix and got the IRF's of the macro variables to money supply shock. But I have to find out the IRF's of food prices to money supply shocks. I have done SUR on my first equation z1_t and
an unrestricted VAR for second vector of macro variables z2_t. I do not know how to link up the two, because I need to apply the long run identification strategy from the z2 sub system to z1

I need to find out the variance co variance matrix of z_t. Could you please help me. I have run the following code.

Code: Select all

*
CALENDAR(q) 1981:1
open data lkdata1.xls
data(format=xls,org=cols) 1981:1 2013:4 FA	GDP	INR	CPI	NMS

*
set rgdp = (gdp/cpi)*100
set grrgdp = log(rgdp/rgdp{1})*100
set rms = (nms/cpi)*100
set grrms = log(rms/rms{1})*100
set grnms = log(nms/nms{1})*100
set inflation = ((cpi-cpi{1})/cpi{1})*100
set lnrgdp = log(rgdp)
set lnrms = log(rms)
set lnnms = log(nms)
diff lnrgdp / dlnrgdp
diff lnrms / dlnrms
diff lnnms / dlnnms
diff fa / dfa
statistics(noprint) dlnrgdp 1981:2 1991:4; compute dlnrgdp_mean1 = %mean
statistics(noprint) dlnrgdp 1992:1 2013:4; compute dlnrgdp_mean2 = %mean
set dlnrgdp_dm 1981:2 1991:4 = dlnrgdp - dlnrgdp_mean1
set dlnrgdp_dm 1992:1 2013:4 = dlnrgdp - dlnrgdp_mean2
statistics(noprint) dlnrms 1981:2 1991:4; compute dlnrms_mean1 = %mean
statistics(noprint) dlnrms 1992:1 2013:4; compute dlnrms_mean2 = %mean
set dlnrms_dm 1981:2 1991:4 = dlnrms - dlnrms_mean1
set dlnrms_dm 1992:1 2013:4 = dlnrms - dlnrms_mean2
statistics(noprint) dlnnms 1981:2 1991:4; compute dlnnms_mean1 = %mean
statistics(noprint) dlnnms 1992:1 2013:4; compute dlnnms_mean2 = %mean
set dlnnms_dm 1981:2 1991:4 = dlnnms - dlnnms_mean1
set dlnnms_dm 1992:1 2013:4 = dlnnms - dlnnms_mean2

compute p = 4, ksteps = 50, nvar = 4
declare vector[series] depvar(4)
labels depvar(1) depvar(2) depvar(3) depvar(4)
# 'GDP' 'Interest Rate' 'Real Money' 'Nominal Money'
smpl 1981:2 2013:4
inquire(smpl) nbeg nend
set depvar(1) 1981:2 nend = dlnrgdp_dm
set depvar(2) 1981:2 nend = inr
set depvar(3) 1981:2 nend = dlnrms_dm
set depvar(4) 1981:2 nend = dlnnms_dm


* VAR estimation
system(model=var)
variables depvar
lags 1 to p
det constant trend
end(system)
estimate(model=var,cvout=sigma,residuals=res_vector,coeffs=B)

*Identification from the macro subsystem
compute C22_1 = inv(%varlagsums)
compute H =  C22_1*sigma*tr(C22_1)
compute D22_1 = %decomp(H)
compute D22_0 = inv(C22_1)*D22_1
impulses(model=var,result=impulses,decomp=D22_0,steps=ksteps)
display D22_1


compute implabel = || "GDP","Interest Rate","Real Money","Nominal Money" ||
@varirf(model=var,steps=ksteps,varlabels=implabel,page=byshocks)

linreg(define=equationz1) dfa
 # dfa{1 to p} depvar(1){1 to p} $
depvar(2){1 to p} $
depvar(3){1 to p} depvar(4){1 to p}
sur(outsigma=v) 1
# equationz1
Many Thanks.
Last edited by RK2509 on Fri Aug 21, 2015 11:46 pm, edited 3 times in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VAR using long run identifying retrictions

Unread post by TomDoan »

var+equationz1 creates the combined model. However, why are you using SUR on a single equation?

BTW, this

statistics(noprint) dlnrgdp 1981:2 1991:4; compute dlnrgdp_mean1 = %mean
set dlnrgdp_dm 1981:2 1991:4 = dlnrgdp - dlnrgdp_mean1

can be done much more simply with

diff(center) dlnrgdp 1981:2 1991:4 dlnrgdp_dm
RK2509
Posts: 30
Joined: Wed Apr 15, 2015 3:16 pm

Re: VAR using long run identifying retrictions

Unread post by RK2509 »

Hi Tom,

Thank you so much.

I see that the diff(center) dlnrgdp 1981:2 1991:4 dlnrgdp_dm is a much simpler way to demean my variables and difference.

1. I understand that SUR for one equation is not making much sense. So I tried the linear regression OLS. Here's the code. Could you tell me how do I get the covariance matrix of the residuals. If I use vcv, I get the covariance matrix of the parameters. But I want the covariance matrix of the error term.

linreg(define=equationz1) dfa 1981:1 2013:4 resids
# constant dfa{1 to p} depvar(1){1 to p} $
depvar(2){1 to p} $
depvar(3){1 to p} depvar(4){1 to p}


2. Also, when I combine the two models i.e the VAR and equationz1 I am basically typing out

Compute Y_t = equationz1 + VAR

I need to find the covariance matrix of the error terms for this whole model (the entire system) and I need to the partition it.. How should I do? Should I again define Y_t as a VAR?
I am not too sure if what I am doing is correct, but still I want to try. I will ask my professor too about the concept if it is right. But right now I am struggling with the code. I am totally new to RATS. I am extremely very grateful to you for all the help.

Thank you so much
Last edited by RK2509 on Fri Aug 21, 2015 11:38 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VAR using long run identifying retrictions

Unread post by TomDoan »

kuhelika wrote:Hi Tom,

Thank you so much.

I see that the diff(center) dlnrgdp 1981:2 1991:4 dlnrgdp_dm is a much simpler way to demean my variables and difference.

1. I understand that SUR for one equation is not making much sense. So I tried the linear regression OLS. Here's the code. Could you tell me how do I get the covariance matrix of the residuals. If I use vcv, I get the covariance matrix of the parameters. But I want the covariance matrix of the error term.

linreg(define=equationz1) dfa 1981:1 2013:4 resids
# constant dfa{1 to p} depvar(1){1 to p} $
depvar(2){1 to p} $
depvar(3){1 to p} depvar(4){1 to p}
You need to save the residuals from both the ESTIMATE instruction and from the LINREG and do a VCV instruction to compute a system-wide covariance matrix of residuals.
kuhelika wrote: 2. Also, when I combine the two models i.e the VAR and equationz1 I am basically typing out

Compute Y_t = equationz1 + VAR

I need to find the covariance matrix of the error terms for this whole model (the entire system) and I need to the partition it.. How should I do? Should I again define Y_t as a VAR?
I am not too sure if what I am doing is correct, but still I want to try. I will ask my professor too about the concept if it is right. But right now I am struggling with the code. I am totally new to RATS. I am extremely very grateful to you for all the help.
As mentioned above, use the VCV instruction to get the system-wide covariance matrix. You can use the %XSUBMAT instruction to pull blocks out of that. However, if you're using Lastrapes' method isn't the cross covariance between the two blocks assumed to be zero. If they aren't, you can't use LINREG to get the maximum likelihood estimates of the DFA equation.
Post Reply