Page 1 of 1

Partial information in Dynare 4.20

PostPosted: Mon Feb 21, 2011 6:33 pm
by pwelz
Dear all,

I tried to run the partial information option on a relatively simple model. I might not have specifed the mod-file correctly but still I think that there is a bug in the error handling that starts in the function "PI_gensys".

The try-catch block in that function reports an error ("Operands to the || and && operators must be convertible to logical scalar values.") which is why Matlab steps out of "PI_gensys" at line 105 without assigning the output arguments. Next the function "dr1_PI" sets "options_.partial_information = 0" but still "info=0". Hence, "PCL_resol" does not abort in line 134 and instead "stoch_simul" crashes in line 132 because the varianle PCL_varobs has not been assigned.

The model solves fine under full informatio without using the partial info option, but specifiying full information as

varobs PIE, X, Y, Yf, MC, R, G, A, Rf, U;
stoch_simul(partial_information,irf=16) R PIE MC Y;

als lead to a crash.

I enclose the code below.

Thanks in advance.

Peter

Code: Select all
// example 1 Gali's model

var PIE, X, Y, Yf, MC, R, G, A, Rf, U;
varexo epsG, epsA, epsR,epsU;

parameters beta, sigma, phi, fx, fpi, fr, rhoa, rhog, rhou, theta;

beta    = 0.99;
theta   = 0.75;
sigma   = 1.50;
phi     = 2.00;
fx      = 0.50;
fpi     = 1.50;
fr      = 0.80;
rhog    = 0.80;
rhoa    = 0.85;
rhou    = 0.00;

model(linear);
// Parameter definitions
# psia = (1+phi)/(sigma+phi);
# psig = sigma/(sigma+phi);
# lambda = (1-beta*theta)*(1-theta)/theta;

// Model equations
PIE = beta * PIE(+1) + lambda*MC+U;
Y   = Y(+1) - 1/sigma*(R-PIE(+1)-Rf);
R   = fr*R(-1) + (1-fr)*(fpi*PIE + fx*X) + epsR;
MC  = (sigma+phi)*Y - (1+phi)*A - sigma*G;

// Output gap
X = Y - Yf;

// flex price model
Rf = sigma*psia*(rhoa-1)*A - sigma*(1-psig)*(rhog-1)*G;
Yf = psia*A + psig * G;

//
A = rhoa*A(-1) + epsA;
G  = rhog*G(-1) + epsG;
U  = rhou*U(-1) + epsU;
end;

shocks;
var epsG;
stderr 1;
var epsR;
stderr 1;
var epsA;
stderr 1;
var epsU;
stderr 1;

end;

//stoch_simul(linear,irf=16,simul) R PIE MC X Y Yf Rf A G;
//stoch_simul(linear,irf=16,simul) R PIE MC Y;
varobs PIE R Y;
stoch_simul(partial_information,irf=16) R PIE MC Y;

Re: Partial information in Dynare 4.20

PostPosted: Tue Feb 22, 2011 1:51 pm
by SébastienVillemot
Thanks for reporting this. It is indeed a bug in the partial information code, which will be fixed in the next release.

In the meantime, you can use the version of PI_gensys.m attached to this message, and which contains the fix.

Re: Partial information in Dynare 4.20

PostPosted: Tue Feb 22, 2011 6:01 pm
by pwelz
Thanks a lot, Sebastian.

There is a second bug in "dr1_PI.m" on line 356 which reads

Code: Select all
if eu ~=[1; 1] && options_.ACES_solver==0


The output from "eu ~=[1; 1] " is not a scalar.

One possible correction might be

Code: Select all
if any(eu ~=[1; 1]) && options_.ACES_solver==0


Best,

Peter

Re: Partial information in Dynare 4.20

PostPosted: Wed Feb 23, 2011 9:11 am
by SébastienVillemot
Thanks, I have fixed that too.