
models                                  = {'NK_BR'}; % Dynare .mod file name
n_models                                = length(models);

% Forecasting and estimation options
first_obs                               = 4;                       % First observation to use 
burnin                                  = 20;                      % Use burinin obs before forecasting  
nobs                                    = 20;                     % Last observation at which forecasts are made
reestim                                 = 4;                       % Model is re-estimated every reestim periods 
Tforc                                   = 9;                       % Model predicts Tforc periods ahead
Tforc_w                                 = 4;                       % Number of predictions used in calculation of weights
mh_replic                               = 5000;
mh_nblocks                              = 2;
mh_drop                                 = 1/5;
scale                                   = 1/4;
modecompute                             = 5;

modfile        = models{1};

% Estimate model via Dynare
command_string = ['dynare ' modfile ' noclearall'];
command_string = [command_string ' -Dfirst_obs_="' num2str(first_obs,'%d') '"'];
command_string = [command_string ' -Dnobs_="' num2str(nobs,'%d') '"'];
command_string = [command_string ' -Dmh_replic_="' num2str(mh_replic,'%d') '"'];
command_string = [command_string ' -Dmh_nblocks_="' num2str(mh_nblocks,'%d') '"'];
command_string = [command_string ' -Dmh_drop_="' num2str(mh_drop,'%1.15f') '"'];
command_string = [command_string ' -Dmh_jscale_="' num2str(scale,'%1.15f') '"'];
command_string = [command_string ' -DTforc_="' num2str(Tforc,'%d') '"'];


T = evalc(command_string);