Can you help me to correct the code below please? I want to restrict "when Government expenditure (Gt) increases, government expenditure (gt) will increase, Taxes (Tt) will increase, GDP (Yt) will increase and Unemployment rate (Xt) will decrease". My codes are:
Code: Select all
OPEN DATA "E:\metarials fiscal shocks\data for running model\var6.xls"
CALENDAR(Q) 1984:1
DATA(FORMAT=XLS,ORG=COLUMNS,SHEET="data for VAR (2)") 1984:01 2014:04 Yt Gt Tt Xt It Pt
* detrend by hp filter*
filter(type=hp,tuning=1600) gt / hpgt
set gt = gt-hpgt
filter(type=hp,tuning=1600) tt / hptt
set tt = tt-hptt
filter(type=hp,tuning=1600) yt / hpyt
set yt = yt-hpyt
filter(type=hp,tuning=1600) xt / hpxt
set xt = xt-hpxt
filter(type=hp,tuning=1600) it / hpit
set it = it-hpit
SYSTEM(MODEL=FISCALPOLICY)
VARIABLES GT TT YT XT IT PT
LAGS 1 TO 2
DET
END(SYSTEM)
ESTIMATE 1984:01 2014:04
dec vect[strings] vl(6)
compute vl=||"gt","tt","yt","xt","it","pt"||
*set various limits*
compute nvar =6
compute nsteps=60
compute nkeep =1000
compute n2 =50000
compute KMIN =1
compute KMAX =6
*Compute standard impulse response functions*
compute atilde=%decomp(%sigma)
impulse(model=fiscalpolicy,steps=nsteps,results=impulses,$
factor=atilde,print)
*
dec vect[series] mini(nvar) maxi(nvar)
dec series[vect] oneresp
dec vect a(nvar) atest ik
dec vect[series] impacts(nvar)
*
do i=1,nvar
set impacts(i) 1 nkeep = %na
end do i
*
do i=1,nvar
set mini(i) 1 nsteps = 1.e+10
set maxi(i) 1 nsteps = -1.e+10
end do i
*
compute accept=0
infobox(action=define,progress,lower=1,upper=nkeep) $
"Monte Carlo Integration"
do draws=1,n2
**Take a draw from the unit sphere.*
compute a=%ransphere(nvar)
**Transform back to the original variable space*
compute atest=atilde*a
**Flip the sign if the GE shock is negative*
if atest(1)<0
compute a=-1.0*a
do k=KMIN,KMAX
compute ik=%xt(impulses,k)*a
if ik(1)<0.or.ik(2)<0.or.ik(3)<0.or.ik(4)>0
goto reject
end do k
gset oneresp 1 nsteps = %xt(impulses,t)*a
do i=1,nvar
set maxi(i) 1 nsteps = %max(oneresp{0}(i),maxi(i))
set mini(i) 1 nsteps = %min(oneresp{0}(i),mini(i))
end do i
compute accept=accept+1
compute %pt(impacts,accept,atilde*a)
infobox(current=accept)
if accept==nkeep
break
:reject
end do draws