GIRF
Posted: Tue Feb 19, 2013 8:14 am
Hi there,
I'm estimating a smooth transition model in the first step and I want to obtain a Generalized Impulse Reponse function afterwards. I have attached the code below.
The codes ie generally working but there is one problem: BD is my left hand side variable and the current version shocks BD. However, my aim is to analyze how a shock to one the regressors, mmod, affects BD. However, I'm not sure how to modify the second part of the code in order to tackles this issue. Any help is highly appreciated.
Thanks
Gibril
compute gstart = 2003:01
compute gend = 2011:09
set CI = 0,617*mm0-bro1_NED+2,8+1,678*I1t-0,371*I1t*mm0
set mm0d = mm0-mm0(t-1)
set a = mm0d
statistics a
*statistics CI
set b = bro1_NED
set bd = bro1_NED-bro1_NED(t-1)
set mmod = mm0-mm0(t-1)
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 alpha3 alpha4 alpha5 alpha6 gamma1
frml transfct2 = (1+exp(-scalef*gamma1*(mm0d(t-1))))^-1
frml strgl1 bd = mu0+alpha1*(a)+alpha3*bd(t-1)+alpha5*CI(t-1)+transfct2(T)*(mu1+alpha2*(a)+alpha4*bd(t-1)+alpha6*CI(T-1))
compute gamma1=1.46, mu0=0,mu1=0,alpha1=1, alpha2=alpha3=alpha4=alpha5=alpha6=1
nlsystem(parmset=P,iters=900,subiters=3000,robust,lwindow=neweywest,residuals=Vector1,dervives=vector2,cvout=aa,lags=24) gstart gend strgl1
group(CV=%sigma~\aa) estr strgl1>>bd
statistics mm0
clear girf
clear girf
compute stddev=0.026281 *sqrt(%seesq)
set girf 2005:05 2005:05+80 = 0.0
compute ndraws=1000
do draw=1,ndraws
set shocks = %ran(stddev)
Forecast(paths,model=estr,from=2005:05,steps=80,results=basesims)
# shocks
compute ishock=500*0.0064
compute shocks(2005:05)=shocks(2005:05)+ishock
Forecast(paths,model=estr,from=2005:05,steps=80,results=sims)
# shocks
set girf 2005:05 2005:05+80 = girf+(sims(1)-basesims(1))/ishock
end do draw
set girf 2005:05 2005:05+80 = girf/ndraws
graph1
# girf
graph2
# bd
I'm estimating a smooth transition model in the first step and I want to obtain a Generalized Impulse Reponse function afterwards. I have attached the code below.
The codes ie generally working but there is one problem: BD is my left hand side variable and the current version shocks BD. However, my aim is to analyze how a shock to one the regressors, mmod, affects BD. However, I'm not sure how to modify the second part of the code in order to tackles this issue. Any help is highly appreciated.
Thanks
Gibril
compute gstart = 2003:01
compute gend = 2011:09
set CI = 0,617*mm0-bro1_NED+2,8+1,678*I1t-0,371*I1t*mm0
set mm0d = mm0-mm0(t-1)
set a = mm0d
statistics a
*statistics CI
set b = bro1_NED
set bd = bro1_NED-bro1_NED(t-1)
set mmod = mm0-mm0(t-1)
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 alpha3 alpha4 alpha5 alpha6 gamma1
frml transfct2 = (1+exp(-scalef*gamma1*(mm0d(t-1))))^-1
frml strgl1 bd = mu0+alpha1*(a)+alpha3*bd(t-1)+alpha5*CI(t-1)+transfct2(T)*(mu1+alpha2*(a)+alpha4*bd(t-1)+alpha6*CI(T-1))
compute gamma1=1.46, mu0=0,mu1=0,alpha1=1, alpha2=alpha3=alpha4=alpha5=alpha6=1
nlsystem(parmset=P,iters=900,subiters=3000,robust,lwindow=neweywest,residuals=Vector1,dervives=vector2,cvout=aa,lags=24) gstart gend strgl1
group(CV=%sigma~\aa) estr strgl1>>bd
statistics mm0
clear girf
clear girf
compute stddev=0.026281 *sqrt(%seesq)
set girf 2005:05 2005:05+80 = 0.0
compute ndraws=1000
do draw=1,ndraws
set shocks = %ran(stddev)
Forecast(paths,model=estr,from=2005:05,steps=80,results=basesims)
# shocks
compute ishock=500*0.0064
compute shocks(2005:05)=shocks(2005:05)+ishock
Forecast(paths,model=estr,from=2005:05,steps=80,results=sims)
# shocks
set girf 2005:05 2005:05+80 = girf+(sims(1)-basesims(1))/ishock
end do draw
set girf 2005:05 2005:05+80 = girf/ndraws
graph1
# girf
graph2
# bd