Error message when trying to estimate with bayesian methods

Dear all,

I am trying to estimate a small open economy model with Bayesian methods. My model is log-lineraized and I use quarterly data on output (y_hat), monthly data on inflation (pi_c_h) and monthly data on net exports (ex_h - im_h). I have two shocks (terms of trade shock and foreign output shock) and I decided to introduce only one measurement error on observed domestic output (eps_y_ME) at first. I use data from an excel file. When I run my mod file, I keep having the following error message saying that there is no defined function for inflation data:

"
dynare Model.mod
Using 64-bit preprocessor
Starting Dynare (version 4.6.1).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Substitution of endo lags >= 2: added 1 auxiliary variables and equations.
Found 13 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs …
done
Preprocessing completed.

Warning: Some of the parameters have no value (a51, a52, a53, a57, a58, a61, a62, a63, a67, a69, a71, a82, a93,
b12, b13, b14, b22, b23, b25, b32, b33, b36, b41, b43, b47, b48, b49, b52, b53, b54, b58, b62, b63, b64, b69, b73,
b82, b93) when using steady. If these parameters are not initialized in a steadystate file or a
steady_state_model-block, Dynare may not be able to solve the model…
Error using eval
Undefined function or variable ‘pi_c_obs’.

Error in Model_steadystate (line 149)
eval([‘ys(’ int2str(ii) ') = ’ M_.endo_names{ii} ‘;’]);

Error in evaluate_steady_state_file (line 49)
[ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);

Error in evaluate_steady_state (line 210)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, options,steadystate_check_flag);

Error in steady_ (line 55)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);

Error in steady (line 80)
[oo_.steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in Model.driver (line 365)
steady;

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;
"

Hope someone can help me with this,
Thank you!


Mod file:

// Specify Variables and parameters:
var ex_h // log lin exports
y_h // log lin domestic output
im_h // log lin imports
pi_c_h // inflation
a1_h
a2_h
temp_h // lagged terms of trade (-1)
ystar_h // log lin foreign output
delta_h // log lin terms of trade
y_obs // domestic output data
pi_c_obs // inflation data
nex_obs; // net exports data: ex - im

varexo epsy // foreign output shock
epsd // terms of trade shock
eps_y_ME; // measurement error of y_obs

parameters theta b_eta eta s_igma g_amma a omega rho_y rho_d sigma_y sigma_d a51 a52 a53 a57 a58 a61 a62 a63 a67 a69 a71 a82 a93 b12 b13 b14 b22 b23 b25 b32 b33 b36 b41 b43 b47 b48 b49 b52 b53 b54 b58 b62 b63 b64 b69 b73 b82 b93;

// calibration:
b_eta=0.995; % discount factor
g_amma=0.23; % long run share of foreign consumption
s_igma=1.32; % inverse intertemporal elasticities of substitution
eta=0.98; % inverse labor supply elasticity
a=0.88; % elasticity of domestic consumption
theta=6; % elasticity of substitution between domestic varieties (implies a mark up of 1.2)
omega=0.75; % domestic Calvo parameter
rho_y=0.9; % persistence foreign demand shock
rho_d=0.9; % persistence terms of trade shock
sigma_y=0.01; % stderr of epsy
sigma_d=0.01; % stderr of epsd

// Specify the model:
model(linear);

0 = b12ystar_h + b13delta_h + b14y_h;
0 = b22
ystar_h + b23delta_h + b25ex_h;
0 = b32ystar_h + b33delta_h + b36im_h;
0 = b41
temp_h + b43delta_h + b47pi_c_h + b48a1_h + b49a2_h;
a51temp_h(+1) + a52ystar_h(+1) + a53delta_h(+1) + a57pi_c_h(+1) + a58a1_h(+1) = b52ystar_h + b53delta_h + b54y_h + b58a1_h;
a61
temp_h(+1) + a62ystar_h(+1) + a63delta_h(+1) + a67pi_c_h(+1) + a69a2_h(+1) = b62ystar_h + b63delta_h + b64y_h + b69a2_h;
a71temp_h = b73delta_h(-1);
a82ystar_h = b82ystar_h(-1) + epsy;
a93delta_h = b93delta_h(-1) + epsd;

y_obs = y_h + y_h(-1) + y_h(-2) + eps_y_ME; // adjust quarterly data to fit monthly data
pi_c_obs = pi_c_h;
nex_obs = ex_h - im_h;
end;

steady;
check;

varobs y_obs pi_c_obs nex_obs;

// Specify shocks:
shocks;
var epsy; stderr sigma_y;
var epsd; stderr sigma_d;
var eps_y_ME; stderr 0.1;
end;

estimated_params;
s_igma, gamma_pdf,1.5 ,0.10;
eta, gamma_pdf,1,0.1 ;
a,gamma_pdf,1, 0.1;
theta,uniform_pdf, , ,5, 7;
rho_y,uniform_pdf, , ,0,1;
rho_d, uniform_pdf, , ,0,1;
stderr epsd,uniform_pdf, , ,0.01,0.03;
stderr epsy, uniform_pdf, , ,0.01, 0.03;
stderr eps_y_ME, normal_pdf, 0, 0.1;
end;

// Simulation:

estimation(datafile=SOEMData, xls_sheet = SOEMData, xls_range = A2:D241, mode_compute=4, mode_check, mh_replic=2000,mh_nblocks=2,mh_jscale=2.5, mh_drop=0.1, bayesian_irf,irf=40);


The steady state file:

function [ys,params,check] = Model_steadystate(ys,exo,M_,options_)
% function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
% computes the steady state for the NK_baseline.mod and uses a numerical
% solver to do so
% Inputs:
% - ys [vector] vector of initial values for the steady state of
% the endogenous variables
% - exo [vector] vector of values for the exogenous variables
% - M_ [structure] Dynare model structure
% - options [structure] Dynare options structure
%
% Output:
% - ys [vector] vector of steady state values for the the endogenous variables
% - params [vector] vector of parameter values
% - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impose restrictions on parameters)

% Copyright © 2013-2020 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see http://www.gnu.org/licenses/.

%% Step 0: initialize indicator and set options for numerical solver
check=0;
options= optimset(‘Display’,‘Final’,‘TolX’,1e-10,‘TolFun’,1e-10);

%% Step 1: read out parameters to access them with their name

for ii = 1:M_.param_nbr
eval([ M_.param_names{ii} ’ = M_.params(’ int2str(ii) ‘);’]); % Get the value of parameter i.
end % End of the loop.

%% Step 2: Enter model equations here

% values of the parameters I use here:
b_eta=0.995; % discount factor
s_igma=1.32; % inverse intertemporal elasticities of substitution
eta=0.98; % inverse labor supply elasticity
g_amma=0.23; % long run share of foreign consumption
a=0.88; % elasticity of domestic consumption
theta=6; % implies a mark up of 1.2
omega=0.75; % domestic Calvo parameter
rho_y=0.9; % persistence foreign demand shock
rho_d=0.9; % persistence terms of trade shock
sigma_y=0.01;
sigma_d=0.01;

% log-lin variables in SS:

ex_h=0;
y_h=0;
im_h=0;
pi_c_h=0;
a1_h=0;
a2_h=0;
temp_h=0;
ystar_h=0;
delta_h=0;
y_obs =0;
infla_obs = 0;

% variables values in SS:
delta=1;
temp=1;
pi_c=1;
pi_h=1;
psi=(theta-1)/theta;
y=psi^(1/(eta+s_igma));
w=psi;
ystar=y;
c=y;
n=y;
ex=g_ammaystar;
im=g_amma
ystar;
a1=ypsi/(1-omegab_eta);
a2=y/(1-omega*b_eta);

a51=-(a1b_etag_ammaomegatemp*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(theta + 1)(delta^(1 - a)g_amma - g_amma + 1))/(temp^a(g_ammatemp^(1 - a) - g_amma + 1)^2);
a52=(a1b_etadeltaomegas_igmaystarystar^(s_igma - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma));
a53=delta
((a1b_etaomega*(ystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma)) + (a1b_etag_ammaomega*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(theta + 1))/(delta^a*(g_ammatemp^(1 - a) - g_amma + 1)));
a57=pi_c
((a1b_etaomega*(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1))/pi_c^2 - (a1b_etaomega*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1))(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(theta + 1))/pi_c);
a58=-(a1b_etaomega*(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1))/pi_c;
a61=-(a2b_etag_ammaomegatemptheta((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 1)(delta^(1 - a)g_amma - g_amma + 1))/(temp^a(g_ammatemp^(1 - a) - g_amma + 1)^2);
a62=(a2b_etadeltaomegas_igmaystarystar^(s_igma - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma));
a63=delta
((a2b_etaomega*(ystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma)) + (a2b_etag_ammaomegatheta((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 1))/(delta^a*(g_ammatemp^(1 - a) - g_amma + 1)));
a67=pi_c
((a2b_etaomega*(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta)/pi_c^2 - (a2b_etaomegatheta((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1))(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 1))/pi_c);
a69=-(a2b_etaomega*(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta)/pi_c;
a71=temp;
a82=ystar;
a93=delta;

b12=ystar*(delta^ag_amma - (deltaystar^(s_igma - 1)(g_amma - 1)(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1)));
b13=-delta
(((ystar^s_igma
(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(g_amma - 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1))/(s_igma(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1))) - adelta^(a - 1)g_ammaystar + (ag_amma(g_amma - 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))/(delta^a(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1) + 1)));
b14=-y;
b22=delta^a
g_ammaystar;
b23=a
deltadelta^(a - 1)g_ammaystar;
b25=-ex;
b32=(delta
delta^(1 - a)g_ammaystarystar^(s_igma - 1)(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1));
b33=delta
((delta^(1 - a)g_amma(ystar^s_igma
(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1))/(s_igma(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1))) - (g_amma(a - 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))/(delta^a(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1))) + (adelta^(1 - a)g_amma^2(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))/(delta^a(delta^(1 - a)g_amma - g_amma + 1)^(a/(a - 1) + 1)));
b36=-im;
b41=(g_amma
omegapi_ctemp*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 2)(theta - 1)(delta^(1 - a)g_amma - g_amma + 1))/(temp^a(g_ammatemp^(1 - a) - g_amma + 1)^2);
b43=-(delta
g_ammaomegapi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1) - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 2)(theta - 1))/(delta^a(g_ammatemp^(1 - a) - g_amma + 1));
b47=omega
pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1))(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta - 2)(theta - 1);
b48=(a1
theta*(omega - 1))/(a2*((a1theta)/(a2(theta - 1)))^theta);
b49=-(a1theta(omega - 1))/(a2*((a1theta)/(a2(theta - 1)))^theta);
b52=ystar*(deltas_igmayy^etaystar^(s_igma - 1)((deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))^(s_igma - 1)(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1) + (a1b_etadeltaomegas_igmaystar^(s_igma - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma + 1)));
b53=delta
((g_ammayy^eta*((deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))^s_igma)/(delta^a(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) + 1)) + (yy^eta*(ystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)((deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))^(s_igma - 1)(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma - 1))/(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) + (a1b_etaomega*(ystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^(theta + 1)(deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma + 1)));
b54=y
((y^eta*((deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))^s_igma)/(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) + (etayy^(eta - 1)((deltaystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))^s_igma)/(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)));
b58=-a1;
b62=(a2
b_eta
deltaomegas_igmaystarystar^(s_igma - 1)(pi_c((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma)(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma + 1));
b63=(a2
b_etadeltaomega*(ystar^s_igma*(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)) - (deltag_ammaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1) - 1))/delta^a)(pi_c*((delta^(1 - a)g_amma - g_amma + 1)/(g_ammatemp^(1 - a) - g_amma + 1))^(1/(a - 1)))^theta*(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma))/(pi_c(deltaystar^s_igma(delta^(1 - a)g_amma - g_amma + 1)^(1/(a - 1)))^(1/s_igma + 1));
b64=y;
b69=-a2;
b73=delta;
b82=rho_y
ystar;
b93=delta*delta^(rho_d - 1)*rho_d;

%% Step 3: Update parameters and variables

params=NaN(M_.param_nbr,1);
for iter = 1:M_.param_nbr %update parameters set in the file
eval([ ‘params(’ num2str(iter) ') = ’ M_.param_names{iter} ‘;’ ])
end

for ii = 1:M_.orig_endo_nbr %auxiliary variables are set automatically
eval([‘ys(’ int2str(ii) ') = ’ M_.endo_names{ii} ‘;’]);
end


I actually found out why I got this error message (I didnt specify the inflation and net exports observed variables in the steady state). I fixed it and ran the mod file but now I get an error message regarding the excel file:

Error using xlsread (line 257)
Worksheet ‘SOEMData’ not found.

Error in load_xls_file_data (line 79)
[num,txt,raw] = xlsread(file, sheet, range);

Error in load_data (line 49)
[~, init, data, varlist] = load_xls_file_data(filename, sheet, range);

Error in dseries (line 67)
[init, o.data, o.name, o.tex, o.ops, o.tags] = load_data(varargin{1});

Error in makedataset (line 122)
DynareDataset = dseries(datafile);

Error in dynare_estimation_init (line 549)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag,
gsa_flag);

Error in dynare_estimation_1 (line 112)
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in Model.driver (line 401)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

I would need to see the files.

I also fixed the last problem but now I got a new message error:

ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: If this is not a problem with the setting of options (check the error message below),
ESTIMATION_CHECKS: you should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):

Error using initial_estimation_checks (line 63)
initial_estimation_checks:: Estimation can’t take place because too many shocks have been calibrated
with a zero variance!

Error in initial_estimation_checks (line 63)
error([‘initial_estimation_checks:: Estimation can’‘t take place because too many shocks have
been calibrated with a zero variance!’])

Error in dynare_estimation_1 (line 164)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in Model.driver (line 398)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

I guess this has something to do with the measurement error but I read your pdf and also other references and I dont really understand how I have to deal with measurement errors. In my files, I only introduced one (y_obs measuremnt error).
Here are all my files.
SOEMData.xlsx (83.2 KB)
Model.mod (2.9 KB)
Model_steadystate.m (12.4 KB)

stderr eps_y_ME, normal_pdf, 0, 0.1;

For the measurement error does not make sense. Why do you use a normal distribution? After all, standard deviations cannot be negative. At a mimimum, you need to use a non-zero starting value.

Thank you very much for your help. Indeed I also thought that doesnt make sense but I saw that in a paper but it turned out that I mixed up the definitions of some parameters! I changed it to an inverse gamma distribution but I get an error message I tried many times to fix :

  • when I use mode_compute = 4:

Error using chol
Matrix must be positive definite.

Error in posterior_sampler_initialization (line 84)
d = chol(vv);

Error in posterior_sampler (line 60)
posterior_sampler_initialization(TargetFun, xparam1, vv,
mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation_1 (line 465)
posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in Model.driver (line 400)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

  • when I use mode_compute = 6:

Error using chol Matrix must be positive definite.
Error in gmhmaxlik_core (line 194) dd = transpose(chol(CovJump));
Error in gmhmaxlik (line 100) [PostMode, PostVariance, Scale, PostMean] = gmhmaxlik_core(fun, OldPostMode, bounds, gmhmaxlikOptions, Scale, flag, MeanPar, OldPostVariance, varargin{:});
Error in dynare_minimize_objective (line 271) [opt_par_values, hessian_mat, Scale, fval] = gmhmaxlik(objective_function, start_par_value, …
Error in dynare_estimation_1 (line 219) [xparam1, fval, exitflag, hh, options_, Scale, new_rat_hess_info] = dynare_minimize_objective(objective_function,xparam1,options_.mode_compute,options_,[bounds.lb bounds.ub],bayestopt_.name,bayestopt_,hh,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
Error in dynare_estimation (line 105) dynare_estimation_1(var_list,dname);
Error in Model.driver (line 399) oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 293) evalin(‘base’,[fname ‘.driver’]) ;

My data stays the same (Following the steps in your guide: I use quarterly real output data, log(.) them, applied HP filter and got y_obs = log(GDP_r) - HP(log(GDP_r)). I use monthly inflation and get: pi_c_obs = log(infla_t) - mean(log(infla)). And monthly foreign trade data: real net exports data: nex_obs = nex_real_t - mean(nex_real). I am not sure I treated net exports right to match with the log-linearized model?).
You’ll find my mod and steadystate files attached.
Thanks a lot for your precious help.

Model_steadystate.m (12.4 KB) Model.mod (2.9 KB)

The data is missing.

I attached them in my previous message :

There is a problem with net exports. The scaling is definitely problematic.

Indeed, that’s what I was afraid of. I decided to use imports and exports instead of net exports. I log the data and then HP filtered them. I substracted them and got im_obs and ex_obs. Now the computation works. I can move on with the analysis ! Thank you again for your help!