IRF minimum distance estimator

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
chaveslima
Posts: 18
Joined: Mon Jun 25, 2012 3:49 pm

IRF minimum distance estimator

Unread post by chaveslima »

Hello Tom

I am using a program based on something I’ve gotten on RATS forum for IRF minimum distance estimator. Program is running OK, but the CEEMETRIC statistic comes out with different values in successive runs. Also, there is message of no convergence in the output. Can you give some tips on how to have convergence and get same results on successive runs. Anyway, I am reproducing the CEEMETRIC and parameters statistics bellow, and attaching program and data base. Thanks in advance for any help.

Regards

Ricardo

Code: Select all

FIND Optimization - Estimation by BFGS
NO CONVERGENCE IN 5 ITERATIONS
LAST CRITERION WAS  0.0000000
SUBITERATIONS LIMIT EXCEEDED.
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Function Value                       86.4611

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  B1                            2.748322354  0.128584639     21.37364  0.00000000
2.  B2                           -0.925984923  0.082945827    -11.16373  0.00000000
3.  NAI                          -0.003601027  0.000149905    -24.02206  0.00000000
4.  DELTA1                        0.650786109  0.006989063     93.11493  0.00000000
5.  DELTA2                        0.112792811  0.006621920     17.03325  0.00000000
6.  GAMMA1                        0.999929710  0.000269758   3706.76539  0.00000000
7.  GAMMA2                       -0.628030752  0.008050925    -78.00728  0.00000000
8.  GAMMA3                        0.627869315  0.007114150     88.25641  0.00000000




FIND Optimization - Estimation by BFGS
NO CONVERGENCE IN 5 ITERATIONS
LAST CRITERION WAS  0.0000000
SUBITERATIONS LIMIT EXCEEDED.
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Function Value                        83.5506

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  B1                            2.746996538  0.136081191     20.18645  0.00000000
2.  B2                           -0.926644714  0.086361256    -10.72987  0.00000000
3.  NAI                          -0.003600207  0.000154567    -23.29213  0.00000000
4.  DELTA1                        0.650803519  0.007494003     86.84325  0.00000000
5.  DELTA2                        0.112808882  0.007143159     15.79258  0.00000000
6.  GAMMA1                        0.999914098  0.000301787   3313.30841  0.00000000
7.  GAMMA2                       -0.628032278  0.008344817    -75.26016  0.00000000
8.  GAMMA3                        0.627869592  0.007405665     84.78234  0.00000000
************
program:

OPEN DATA "/RATS 8.0/examples/dadosm.xlsx"
calendar(m) 2000:6
DATA(FORMAT=XLSX,ORG=COLUMNS) 2000:6 2012:12 selic igp pig pit credito juros
*********************************************************************************
*print / selic igp pig pit credito juros

* Transformando Vari·veis
*
set lig = log(pig)
set lit = log(pit)
set lip = log(igp)
set lcre = log(credito)
set lcrer = lcre - lip
set dp = 100*(lip - lip{1})
set selr = selic - dp
set jur = juros**1/12 - dp
*
X11(multiplicative,adjust=slig) lig
*
*
*****VEC-CATS
set d812 = t==2008:12; set d83 = t==2008:3;* dummies para slig
set d012 = t==2001:2; set d0112 = t==2001:12; set d028 = t==2002:8; 
set d029 = t==2002:9; set d0210 = t==2002:10;set d032 = t==2003:2; 
set d0311 = t==2003:11; set dp0112 = t==2001:12
SET TREND = T
SET D200810 = t > 2008:10
***********VEC-RATS***********
set CV1 = SLIG{1} - 0.263*SELR{1} - 0.124*LCRER{1} + 0.18*JUR{1} + 0.117*2008:10 - 0.002*TREND
EQUATION(COEFFS=||1,-0.263,-0.124,0.18,0.117,-0.002||) CVEQ1 CV1
# SLIG{1} SELR{1} LCRER{1} JUR{1} D200810 TREND
*
set CV2 = -14.160*SLIG{1} + SELR{1} + 0.334*LCRER{1} - 1.630*JUR{1} + 0.171*2008:10 + 0.014*TREND
EQUATION(COEFFS=||-14.160,1,0.334,-1.630,0.171,0.014||) CVEQ2 CV2
# SLIG{1} SELR{1} LCRER{1} JUR{1} D200810 TREND
*
*GRAPH 1
*# CV1
*GRAPH 1
*# CV2
*
******VAR*****
system(model=varmodel)
variables slig selr lcrer jur
lags 1 to 9
det constant D200810 d812 d83 d028 d029 d032 d0311 dp0112
ect cveq1 cveq2
end(system)
estimate(NOprint)
***************
compute nsteps=30
source(noecho) "/RATS 8.0/Procedures/MCVARDoDraws.src"
@MCVARDoDraws(model=varmodel,DRAWS=1000,step=nsteps)
source(noecho) "/RATS 8.0/Procedures/mcprocessirf.src"
@MCprocessIRF(model=varmodel,center=mean,STDDEV=1.0,IRF=results,var=estvar,lower=lb,upper=ub)
*print / results
*
dec vect[strings] sl(4)
compute sl=|| "SLIG", "SELR", "LCRER", "JUR" ||
*
*spgraph(vfields=2,hfields=2,header="Estimated IRFs")
*do i=1,4
*
*graph(nodates,header=sl(i)) 3
*# results(i,2)
*# ub(i,2) / 2
*# lb(i,2) / 2
*end do i
*spgraph(done)

*do i=1,4
*print / estvar(i,2)
*end do
*******************
* (First run at) Replication file for Hulsewig, Mayer &
* Wollmershauser(2006),  "Bank loan supply and monetary policy
* transmission in Germany: An assessment based on matching impulse
* responses," Journal of Banking & Finance, vol. 30, no 10, 2893-2910.
*
declare real beta b1 b2 nai delta1 delta2 gamma1 gamma2 gamma3
declare series y l rl rm eta
*
* Set up the DSGE. This uses the original optimization equation from the
* appendix rather than the partially substituted one in the main text.
*
frml(identity) eqna6 = beta*l{-1}-(1+beta)*l+l{1}+nai*(rl-rm)
frml(identity) eqn14 = b2*rl - (b1*y - l)
frml(identity) eqn15 = y - (gamma1*y{1}+gamma2*rl{1}+gamma3*rl{2})
frml(identity) eqn16 = rm - (delta1*rm{1}+delta2*rm{2}+3*eta)
frml s1 = eta
*
compute beta=.99
*compute b1=2.1887,b2=.0142,nai=.0010,delta1=1.4665,delta2=-.5204
*compute gamma1=.9985,gamma2=.0009,gamma3=-.0026
*
compute b1=2.7475 
compute b2=-0.9266
compute nai=-0.0036
compute delta1=0.6508
compute delta2=0.1128
compute gamma1=0.9999
compute gamma2=-0.6280
compute gamma3=0.6279 
*
group loanmodel eqna6 eqn14 eqn15 eqn16 s1
*
dsge(a=a,f=f,model=loanmodel) y rm l rl eta
*
* They don't report the standard error of the shock, but it appears to
* be roughly .2.
*
source(noecho) "/RATS 8.0/Procedures/dlmirf.src"
@dlmirf(a=a,f=f*.2,steps=nsteps,varlabels=||"GDP","RM","LOAN","RL"||,page=byshock,results=theoretical)
*
*do j=1,4
*print / theoretical(j,1) results(j,2)
*end do
*
spgraph(vfields=2,hfields=2,header="theoretical irfs")
do i=1,4
graph(header=sl(i),key=below,nodate) 4
# theoretical(i,1)
# results(i,2)
# ub(i,2) / 3
# lb(i,2) / 3
end do i
spgraph(done)
*
*************************
*
*  You need the estimated IRF's from the VAR and their variances in order
* to do the optimization. This assumes that the estimated IRF's to the
* rate shock are in the series estimated(i,1) and the corresponding
* variances are in estvar(i,1).
*
nonlin(parmset=dsgeparms) b1 b2 nai delta1 delta2 gamma1 gamma2 gamma3
declare real ceemetric
find(parmset=dsgeparms,method=bfgs,stderrs) minimum ceemetric
dsge(a=a,f=f,model=loanmodel) y rm l rl eta
@dlmirf(a=a,f=f*.2,steps=nsteps,results=theoretical,nograph)
compute ceemetric=0.0
do h=2,nsteps
do i=1,4
compute ceemetric=ceemetric+((theoretical(i,1)(h)-results(i,2)(h))^2)/estvar(i,2)(h)
end do i
end do h
end find
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: IRF minimum distance estimator

Unread post by TomDoan »

First of all, this depends upon the mean and variance for the IRF's that come out of a Monte Carlo integration, so it has to be different run to run unless you use a SEED to control that. Or you would have to do many more than 1000 draws to get estimates which are more similar.

The convergence problem almost certainly is because the GAMMA1 is right at the unit root boundary. Also, note that the .2 scale was specific to the example in the article and might not be appropriate for a different data set.
Post Reply