Mom in Dynare 5.0 does not load correct xls_sheet

So many improvements - many thanks!

One query: Is the syntax somehow different for reading data under method_of_moments?

I have been having an issue with reading in data when attempting to estimate using GMM/SMM. Thus, whereas “estimation(datafile=‘xyz.xls’,xls_sheet=‘Sheet5’,first_obs=1,nobs=80,prefilter=1,mode_compute=1)”
reads the data perfectly, in the same model
“method_of_moments(datafile=‘xyz.xls’,xls_sheet=‘Sheet5’,first_obs=1,nobs=80,prefilter=1,mom_method=GMM)”
fails with a message that the datafile does not contain a particular variable (the first).

Regards
Donihue

Can you provide me with the files to replicate the issue?

Thanks for your rapid reply!
A simple mod-file is below. Unsure of how to upload an Excel file …

=====================
%----------------------------------------------------------------
% 0. Housekeeping (close all graphic windows)
%----------------------------------------------------------------
close all;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
var y pi r e_D e_S e_R;
var y_obs pi_obs r_obs;
varexo eta_D eta_S eta_R;
parameters  beta sigma varphi rho phi_pi phi_y theta
			% shocks
			rho_D rho_S rho_R;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
beta    	= 0.99;		  	    % discount factor
sigma		= 1;				% risk aversion consumption
varphi		= 1;				% labor disutility
theta		= 0.75;				% new keynesian Philips Curve, forward term
rho			= 0.80;				% MPR Smoothing
phi_pi		= 1.5;				% MPR Inflation
phi_y		= 0.2;				% MPR GDP
% shock processes
rho_D   = 0.90;
rho_S   = 0.95;
rho_R 	= 0.10;
%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------
model(linear); 
	% IS curve
	y = y(+1) - 1/sigma*(r-pi(+1)) + e_D;
	% AS curve
	pi = beta*pi(+1) + ((1-theta)*(1-beta*theta)/theta)*(sigma+varphi)*y + e_S;
	% Monetary Policy Rule
	r = rho*r(-1) +  (1-rho)*( phi_pi*pi + phi_y*y ) + e_R  ;
	% shocks
	e_D = rho_D*e_D(-1)+eta_D;
	e_S = rho_S*e_S(-1)+eta_S;
	e_R = rho_R*e_R(-1)+eta_R;
	% observable
	r_obs = r;
	y_obs = y;
	pi_obs = pi;
end;

resid;
steady;
check;

shocks;
var eta_D; stderr 0.1;
var eta_S; stderr 0.1;
var eta_R; stderr 0.1;
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
estimated_params;
 	sigma,				,		,		,		gamma_pdf,			1,				0.4;
	varphi,				1,		,		,		gamma_pdf,			2,				0.75;
	phi_pi,				,		,		,		normal_pdf,			1.5,       		0.1;
	phi_y,				0,		,		,		normal_pdf,			0.05,			0.05;
	rho,				,		,		,		beta_pdf,			.75,			0.05;
	theta,				,		,		,		beta_pdf,			.5,	    	    0.1;
end;

varobs 	y_obs pi_obs r_obs;

/*
matched_moments;
y_obs*y_obs; 
pi_obs*pi_obs; 
y_obs*pi_obs;
r_obs*r_obs;
r_obs*y_obs; 
pi_obs*r_obs;
end;
*/
estimation(datafile='JP_New_Zealand_Data.xls',xls_sheet='Sheet5',first_obs=1,nobs=80,mode_compute=1,mh_replic=0,prefilter=1,lik_init=2) y y_obs pi_obs r_obs;
%method_of_moments(datafile='JP_New_Zealand_Data.xls',xls_sheet='Sheet5',first_obs=1,nobs=80,prefilter=1,mom_method=GMM);
stoch_simul(Tex,irf=24) y pi r;
=====================

Please upload a zip file.

Many thanks. Please see attachedRegards
Donihue
Forum_GMM.zip (20.0 KB)

This is caused by a bug. mom always loads the first Excel-Sheet. See Fix loading of `xls_sheet` in mom (#1840) · Issues · Dynare / dynare · GitLab

Thank you.