Make sure options_.first_obs is properly set

time-shift
Johannes Pfeifer 2017-03-20 20:29:19 +01:00 committed by Stéphane Adjemian (Charybdis)
parent 636b959a02
commit 00299a92c1
4 changed files with 70 additions and 1 deletions

View File

@ -44,6 +44,11 @@ end
%store qz_criterium
qz_criterium_old=options_.qz_criterium;
if isnan(options_.first_obs)
first_obs_nan_indicator=true;
else
first_obs_nan_indicator=false;
end
% Set particle filter flag.
if options_.order > 1
@ -775,3 +780,6 @@ if reset_options_related_to_estimation
options_.mode_compute = mode_compute_o;
options_.mh_replic = mh_replic_o;
end
if first_obs_nan_indicator
options_.first_obs=NaN;
end

View File

@ -527,13 +527,16 @@ if ~isempty(options_.datafile)
end
end
if isnan(options_.first_obs)
options_.first_obs=1;
end
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);
%set options for old interface from the ones for new interface
if ~isempty(dataset_)
options_.nobs = dataset_.nobs;
options_.first_obs=double(dataset_.init);
end
% setting steadystate_check_flag option
if options_.diffuse_filter || options_.steadystate.nocheck
steadystate_check_flag = 0;

View File

@ -12,6 +12,7 @@ MODFILES = \
observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.mod \
dates/dseries_interact.mod \
estimation/slice/fs2000_slice.mod \
optimizers/fs2000_9.mod \
optimizers/fs2000_10.mod \

View File

@ -0,0 +1,57 @@
%% Mod-file tests interaction between estimation and shock_decomposition when dseries is used or not
var hh nn log_nn;
varexo eps_a;
parameters alfa nbar lambda betta rho_a std_a nn_init;
nn_init = -0.1;
alfa = 0.05;
lambda = 0.054;
betta = 0.99;
nbar = 1;
rho_a = 0;
std_a = 1;
model(linear);
hh = - alfa * nn + betta * ( hh(+1) + 0 * eps_a(+1) ) + eps_a;
log_nn = log_nn(-1) + hh * lambda / (1-lambda);
log_nn = ln(nbar) + nn;
end;
steady_state_model;
log_nn = log(nbar);
nn = 0;
hh = 0;
end;
shocks;
var eps_a; stderr 1;
end;
estimated_params;
alfa, beta_pdf, 0.1, 0.05;
std_a, inv_gamma_pdf, 0.05, 1;
end;
varobs log_nn;
if ~isoctave() && ~matlab_ver_less_than('8.4')
websave('data_uav.xlsx','http://www.dynare.org/Datasets/data_uav.xlsx', weboptions('Timeout', 30))
else
urlwrite('http://www.dynare.org/Datasets/data_uav.xlsx','data_uav.xlsx')
end
%reading Excel sheet from column A on creates quarterly dseries starting in
%1950
estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
shock_decomposition( parameter_set=posterior_median ) nn hh;
%reading Excel sheet from column B on creates annual dseries starting with 1
estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
shock_decomposition( parameter_set=posterior_median ) nn hh;
delete('data_uav.xlsx')