Page 1 of 1

Optimal Ramsey

PostPosted: Sat May 10, 2014 5:17 pm
by Hazem
Please I am trying to run code to get the optimal ramsey monetary policy. [code][/code]
I got this message
Complex values cannot be converted to logicals.
Error in dr1 (line 362)
if info1
Error in resol (line 97)
[dr,info,M_,options_,oo_] = dr1(dr,check_flag,M_,options_,oo_);
Error in stoch_simul (line 40)
[oo_.dr, info] = resol(oo_.steady_state,0);
Error in ramsey_policy (line 25)
info = stoch_simul(var_list);
Error in mods_ramsey (line 267)
ramsey_policy(var_list_);
Error in dynare (line 102)
evalin('base',fname) ;

This is the code:
var dLGDP dLGDP_BAR G Y
dUNR UNR_GAP dUNR_BAR GU
PIE PIE4 dLCPI E4_PIE4 RS RR RR_BAR PIETAR
LZ LZ_BAR LZ_GAP RRF RRF_BAR LZ_E S
RSF dLCPIF PIEF YF;

varexo RES_LGDP_BAR RES_Y RES_G
RES_UNR_GAP RES_GU RES_UNR_BAR
RES_PIE RES_RR_BAR RES_RS RES_PIETAR RES_RR_DIFF
RES_LZ_BAR
RES_RRF_BAR RES_RRF RES_PIEF RES_YF;

parameters tau;
parameters alpha1 alpha2 alpha3;
parameters beta1 beta2 beta3 beta4 beta5;
parameters lambda1 lambda2 lambda3;
parameters rho gamma1 gamma2 gamma3 ;
parameters phi rhof rhofg rho_pief ;
parameters betaf;

tau = 0.49;


beta1 = 0.44;
beta2 = 0.16;
beta3 = 0.16;
beta4 = 0.09;
beta5 = 0.09;

alpha1 = 0.80;
alpha2 = 0.30;
alpha3 = 0.29;

lambda1 = 0.64;
lambda2 = 0.43;
lambda3 = 0.16;

rho = 0.1;

gamma1 = 0.36;
gamma2 = 1.53;
gamma3 = 0.55;

phi = 0.06;

rhof = 0.5;
rhofg = 0.3;
rho_pief = 0.5;

betaf = 0.54;


model;

//Output block
Y -Y (-1) =dLGDP - dLGDP_BAR;

dLGDP_BAR = G/4 + RES_LGDP_BAR;

G = (1-tau)*G(-1) + RES_G;

Y = beta1*Y(-1) + beta2*Y(+1) - beta3*(RR(-1) - RR_BAR(-1)) + beta4*LZ_GAP(-1) + beta5*YF(-1) + RES_Y;


//Unemployment block

UNR_GAP = dUNR - dUNR_BAR ;

UNR_GAP = alpha1*UNR_GAP(-1) + alpha2*Y + RES_UNR_GAP;

dUNR_BAR = GU+RES_UNR_BAR;

GU = (1-alpha3)*GU(-1) + RES_GU;


//Inflation

PIE = lambda1*PIE(+1) + (1-lambda1)*PIE(-1) + lambda2*Y(-1) + lambda3*(LZ-LZ(-1)) + RES_PIE;

PIE4 = (PIE + PIE(-1) + PIE(-2) + PIE(-3))/4;

PIETAR = 0.99*PIETAR(-1) + RES_PIETAR;

dLCPI = PIE/4;

E4_PIE4 = PIE4(+4);


//Interest rate

RR = RS - PIE(+1);

RR_BAR = (1-rho)*RR_BAR(-1) + RES_RR_BAR;

//RS = gamma2*E4_PIE4 + gamma3*Y;
//RS = gamma1*RS(-1) + (1-gamma1)*(RR_BAR + E4_PIE4 + gamma2*(E4_PIE4-PIETAR(+4)) + gamma3*Y)+ RES_RS;

RSF = RRF + PIEF(+1);

RRF_BAR = (1-rhof)*RRF_BAR(-1) + RES_RRF_BAR;

RRF-RRF_BAR = (1-rhofg)*(RRF(-1) - RRF_BAR(-1)) + RES_RRF;



// Real Exchange rate

LZ_GAP = LZ -LZ_BAR;

LZ_BAR = LZ_BAR(-1) - RES_LZ_BAR;

RR - RRF = 4*(LZ_E(+1)-LZ) + RR_BAR - RRF_BAR + RES_RR_DIFF;

LZ_E = phi*LZ + (1-phi)*LZ(-2);


//Nominal Exchange rate

LZ-LZ(-1) = S-S(-1)-PIE+PIEF;


//Foreign output and foreign inflation

PIEF = (1-rho_pief)*PIEF(-1) + RES_PIEF;

dLCPIF = PIEF/4;

YF = betaf * YF(-1) + RES_YF;


end;

shocks;

var RES_LGDP_BAR; stderr 0.069;
var RES_Y; stderr 0.064;
var RES_G; stderr 0.12;
var RES_GU; stderr 0.19;
var RES_UNR_GAP; stderr 0.45;
var RES_UNR_BAR; stderr 0.37;
var RES_PIE; stderr 0.12;
var RES_RR_BAR; stderr 0.70;
var RES_RS; stderr 0.11;
var RES_PIETAR; stderr 0.12;
var RES_RR_DIFF; stderr 0.11;
var RES_LZ_BAR; stderr 0.13;
var RES_RRF_BAR; stderr 1.70;
var RES_RRF; stderr 0.11;
var RES_PIEF; stderr 3.14;
var RES_YF; stderr 0.16;

end;



steady;

//steady;

planner_objective lambda1*Y^2 + lambda2*PIE^2;

ramsey_policy(planner_discount=0.95, irf=0);


//stoch_simul (periods=50000, irf=30) Y PIE RS GROWTH4 PIE4 RR LZ S LZDIF

Re: Optimal Ramsey

PostPosted: Mon May 12, 2014 2:00 pm
by jpfeifer
Please upgrade to Dynare 4.4.2. When you comment out the steady command, it should run.