Skip to content
Snippets Groups Projects
Verified Commit 48c18522 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Merge branch 'test_speed' of git.dynare.org:JohannesPfeifer/dynare

Ref. !2344
parents 7d90c379 c014b5b5
No related branches found
No related tags found
No related merge requests found
Showing
with 16 additions and 15 deletions
...@@ -31,6 +31,7 @@ function online_auxiliary_filter(xparam1, dataset_, options_, M_, estim_params_, ...@@ -31,6 +31,7 @@ function online_auxiliary_filter(xparam1, dataset_, options_, M_, estim_params_,
% Set seed for randn(). % Set seed for randn().
options_ = set_dynare_seed_local_options(options_,'default'); options_ = set_dynare_seed_local_options(options_,'default');
options_.verbosity=0; %particularly suppress warning messages during k_order_pert within the loop
pruning = options_.particle.pruning; pruning = options_.particle.pruning;
variance_update = true; variance_update = true;
online_opt = options_.posterior_sampler_options.current_options; online_opt = options_.posterior_sampler_options.current_options;
...@@ -78,10 +79,10 @@ xparam = zeros(number_of_parameters,number_of_particles); ...@@ -78,10 +79,10 @@ xparam = zeros(number_of_parameters,number_of_particles);
Prior = dprior(bayestopt_, options_.prior_trunc); Prior = dprior(bayestopt_, options_.prior_trunc);
for i=1:number_of_particles for i=1:number_of_particles
info = 12042009; info = 12042009;
while info while info(1)
candidate = Prior.draw(); candidate = Prior.draw();
[info] = solve_model_for_online_filter(false, candidate, dataset_, options_, M_, estim_params_, bayestopt_, bounds, oo_.dr , oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state); [info] = solve_model_for_online_filter(false, candidate, dataset_, options_, M_, estim_params_, bayestopt_, bounds, oo_.dr , oo_.steady_state, oo_.exo_steady_state, oo_.exo_det_steady_state);
if ~info if ~info(1)
xparam(:,i) = candidate(:); xparam(:,i) = candidate(:);
end end
end end
......
...@@ -47,7 +47,7 @@ s2df = 1; ...@@ -47,7 +47,7 @@ s2df = 1;
// form expression for the joint posterior marginal distribution of β, a Gibbs // form expression for the joint posterior marginal distribution of β, a Gibbs
// sampling algorithm is used (the prior for β and the inverse of σ² are independent). // sampling algorithm is used (the prior for β and the inverse of σ² are independent).
gibbslength = 1000000; // Set the number of iterations in Gibbs gibbslength = 300000; // Set the number of iterations in Gibbs
burnin = 10000; // Set the number of iterations to be discarded (try to remove the effects of the initial condition). burnin = 10000; // Set the number of iterations to be discarded (try to remove the effects of the initial condition).
steps = 10; // Do not record all iterations (try to remove the dependence between the draws). steps = 10; // Do not record all iterations (try to remove the dependence between the draws).
......
...@@ -50,14 +50,14 @@ s2df = 1; ...@@ -50,14 +50,14 @@ s2df = 1;
// form expression for the joint posterior marginal distribution of β, a Gibbs // form expression for the joint posterior marginal distribution of β, a Gibbs
// sampling algorithm is used (the prior for β and the inverse of σ² are independent). // sampling algorithm is used (the prior for β and the inverse of σ² are independent).
gibbslength = 1000000; // Set the number of iterations in Gibbs gibbslength = 100000; // Set the number of iterations in Gibbs
burnin = 10000; // Set the number of iterations to be discarded (try to remove the effects of the initial condition). burnin = 10000; // Set the number of iterations to be discarded (try to remove the effects of the initial condition).
steps = 10; // Do not record all iterations (try to remove the dependence between the draws). steps = 10; // Do not record all iterations (try to remove the dependence between the draws).
ds = olsgibbs(ds, 'eqols', beta0, V0, s2priormean, s2df, gibbslength, burnin, steps, {'eqols', 'eqols_olsgibbs_fit'}, 'olsgibbs_eq',{'b2'; 'b3'}); ds = olsgibbs(ds, 'eqols', beta0, V0, s2priormean, s2df, gibbslength, burnin, steps, {'eqols', 'eqols_olsgibbs_fit'}, 'olsgibbs_eq',{'b2'; 'b3'});
// Since we use a diffuse prior for β, the posterior mean of β should be close to the OLS estimate. // Since we use a diffuse prior for β, the posterior mean of β should be close to the OLS estimate.
if max(abs(oo_.ols.ols_eq.beta-oo_.olsgibbs.olsgibbs_eq.posterior.mean.beta))>.1 if max(abs(oo_.ols.ols_eq.beta-oo_.olsgibbs.olsgibbs_eq.posterior.mean.beta))>.01
error('Something is wrong in the Gibbs sampling routine (univariate model)') error('Something is wrong in the Gibbs sampling routine (univariate model)')
end end
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglin_no_prefilt_first_obs_MC_Exp_AR1_trend_ ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglin_no_prefilt_first_obs_MC_Exp_AR1_trend_
mode_compute=4,silent_optimizer,first_obs=1000,loglinear,smoother,forecast=100,prefilter=0, mode_compute=4,silent_optimizer,first_obs=1000,loglinear,smoother,forecast=100,prefilter=0,
mcmc_jumping_covariance='Trend_loglin_no_prefilt_first_obs_MC_MCMC_jump_covar', mcmc_jumping_covariance='Trend_loglin_no_prefilt_first_obs_MC_MCMC_jump_covar',
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mh_nblocks=1,mh_jscale=0.3,no_posterior_kernel_density) P_obs Y_obs junk2; mh_nblocks=1,mh_jscale=0.3,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_loglin_no_prefilt_first_obs_MC_Exp_AR1_trend_data_with_constant'); load('Trend_loglin_no_prefilt_first_obs_MC_Exp_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglin_prefilt_first_obs_MC_Exp_AR1_trend_dat ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglin_prefilt_first_obs_MC_Exp_AR1_trend_dat
mode_compute=4,silent_optimizer,first_obs=1000,loglinear,smoother,forecast=100,prefilter=1, mode_compute=4,silent_optimizer,first_obs=1000,loglinear,smoother,forecast=100,prefilter=1,
mcmc_jumping_covariance='Trend_loglin_prefilt_first_obs_MC_MCMC_jump_covar_prefilter', mcmc_jumping_covariance='Trend_loglin_prefilt_first_obs_MC_MCMC_jump_covar_prefilter',
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mh_nblocks=1,mh_jscale=1e-4,no_posterior_kernel_density) P_obs Y_obs junk2; mh_nblocks=1,mh_jscale=1e-4,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_loglin_prefilt_first_obs_MC_Exp_AR1_trend_data_with_constant'); load('Trend_loglin_prefilt_first_obs_MC_Exp_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglinear_no_prefilter_MC_Exp_AR1_trend_data_ ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglinear_no_prefilter_MC_Exp_AR1_trend_data_
mode_compute=4,silent_optimizer,first_obs=1,loglinear,diffuse_filter,smoother,forecast=100,prefilter=0, mode_compute=4,silent_optimizer,first_obs=1,loglinear,diffuse_filter,smoother,forecast=100,prefilter=0,
mcmc_jumping_covariance='Trend_loglinear_no_prefilter_MC_MCMC_jump_covar', mcmc_jumping_covariance='Trend_loglinear_no_prefilter_MC_MCMC_jump_covar',
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mh_nblocks=1,mh_jscale=0.3) P_obs Y_obs junk2; mh_nblocks=1,mh_jscale=0.3,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_loglinear_no_prefilter_MC_Exp_AR1_trend_data_with_constant'); load('Trend_loglinear_no_prefilter_MC_Exp_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglinear_prefilter_MC_Exp_AR1_trend_data_wit ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_loglinear_prefilter_MC_Exp_AR1_trend_data_wit
mode_compute=4,silent_optimizer,first_obs=1,loglinear,smoother,forecast=100,prefilter=1, mode_compute=4,silent_optimizer,first_obs=1,loglinear,smoother,forecast=100,prefilter=1,
mcmc_jumping_covariance='Trend_loglinear_prefilter_MC_MCMC_jump_covar_prefilter', mcmc_jumping_covariance='Trend_loglinear_prefilter_MC_MCMC_jump_covar_prefilter',
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mh_nblocks=1,mh_jscale=1e-4) P_obs Y_obs junk2; mh_nblocks=1,mh_jscale=1e-4,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_loglinear_prefilter_MC_Exp_AR1_trend_data_with_constant'); load('Trend_loglinear_prefilter_MC_Exp_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -6,7 +6,7 @@ generate_trend_stationary_AR1(M_.fname); ...@@ -6,7 +6,7 @@ generate_trend_stationary_AR1(M_.fname);
estimation(order=1,datafile='Trend_no_prefilter_MC_AR1_trend_data_with_constant',mh_replic=400,silent_optimizer, estimation(order=1,datafile='Trend_no_prefilter_MC_AR1_trend_data_with_constant',mh_replic=400,silent_optimizer,
mode_compute=4,first_obs=1,smoother,mh_nblocks=1,mh_jscale=0.3, mode_compute=4,first_obs=1,smoother,mh_nblocks=1,mh_jscale=0.3,
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mcmc_jumping_covariance='Trend_no_prefilter_MC_MCMC_jump_covar',forecast=100,prefilter=0) P_obs Y_obs junk2; mcmc_jumping_covariance='Trend_no_prefilter_MC_MCMC_jump_covar',forecast=100,prefilter=0,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_no_prefilter_MC_AR1_trend_data_with_constant'); load('Trend_no_prefilter_MC_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_no_prefilter_first_obs_MC_AR1_trend_data_with ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_no_prefilter_first_obs_MC_AR1_trend_data_with
mh_replic=400,mode_compute=4,silent_optimizer,first_obs=1000,smoother,forecast=100,prefilter=0, mh_replic=400,mode_compute=4,silent_optimizer,first_obs=1000,smoother,forecast=100,prefilter=0,
mcmc_jumping_covariance='Trend_no_prefilter_first_obs_MC_MCMC_jump_covar', mcmc_jumping_covariance='Trend_no_prefilter_first_obs_MC_MCMC_jump_covar',
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mh_nblocks=1,mh_jscale=0.3,no_posterior_kernel_density) P_obs Y_obs junk2; mh_nblocks=1,mh_jscale=0.3,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_no_prefilter_first_obs_MC_AR1_trend_data_with_constant'); load('Trend_no_prefilter_first_obs_MC_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_prefilter_MC_AR1_trend_data_with_constant',mh ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_prefilter_MC_AR1_trend_data_with_constant',mh
first_obs=1,smoother,prefilter=1, first_obs=1,smoother,prefilter=1,
mh_nblocks=1,mh_jscale=1e-4, mh_nblocks=1,mh_jscale=1e-4,
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mcmc_jumping_covariance='Trend_prefilter_MC_MCMC_jump_covar_prefilter',forecast=100) P_obs Y_obs junk2; mcmc_jumping_covariance='Trend_prefilter_MC_MCMC_jump_covar_prefilter',forecast=100,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_prefilter_MC_AR1_trend_data_with_constant'); load('Trend_prefilter_MC_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_prefilter_first_obs_MC_AR1_trend_data_with_co ...@@ -7,7 +7,7 @@ estimation(order=1,datafile='Trend_prefilter_first_obs_MC_AR1_trend_data_with_co
first_obs=1000,smoother,prefilter=1, first_obs=1000,smoother,prefilter=1,
mh_nblocks=1,mh_jscale=1e-4, mh_nblocks=1,mh_jscale=1e-4,
filtered_vars, filter_step_ahead = [1,2,4], filtered_vars, filter_step_ahead = [1,2,4],
mcmc_jumping_covariance='Trend_prefilter_first_obs_MC_MCMC_jump_covar_prefilter',forecast=100,no_posterior_kernel_density) P_obs Y_obs junk2; mcmc_jumping_covariance='Trend_prefilter_first_obs_MC_MCMC_jump_covar_prefilter',forecast=100,no_posterior_kernel_density,nograph,sub_draws=100) P_obs Y_obs junk2;
load('Trend_prefilter_first_obs_MC_AR1_trend_data_with_constant'); load('Trend_prefilter_first_obs_MC_AR1_trend_data_with_constant');
@#include "../Trend_load_data_common.inc" @#include "../Trend_load_data_common.inc"
......
...@@ -105,7 +105,7 @@ varobs y l i ; ...@@ -105,7 +105,7 @@ varobs y l i ;
%datatomfile('mysample') %datatomfile('mysample')
%return; %return;
data(file='./mysample.m',first_obs=801Y,nobs=200); %no measurement errors added in the simulated data data(file='./mysample.m',first_obs=801Y,nobs=50); %no measurement errors added in the simulated data
@#if LINEAR_KALMAN @#if LINEAR_KALMAN
estimation(nograph,order=1,mode_compute=8,silent_optimizer,mh_replic=0,additional_optimizer_steps=[8 4],mode_check); estimation(nograph,order=1,mode_compute=8,silent_optimizer,mh_replic=0,additional_optimizer_steps=[8 4],mode_check);
...@@ -155,7 +155,7 @@ estimation(order=3,nograph,filter_algorithm=gf,proposal_approximation=montecarlo ...@@ -155,7 +155,7 @@ estimation(order=3,nograph,filter_algorithm=gf,proposal_approximation=montecarlo
% estimation(order=3,nograph,number_of_particles=10000,mode_compute=11,mh_replic=0,particle_filter_options=('liu_west_delta',0.9)); % estimation(order=3,nograph,number_of_particles=10000,mode_compute=11,mh_replic=0,particle_filter_options=('liu_west_delta',0.9));
estimation(order=1,posterior_sampling_method='online',posterior_sampler_options=('particles',1000)); estimation(order=1,posterior_sampling_method='online',posterior_sampler_options=('particles',1000));
estimation(order=2,posterior_sampling_method='online',posterior_sampler_options=('particles',1000)); estimation(order=2,posterior_sampling_method='online',posterior_sampler_options=('particles',1000));
estimation(order=3,posterior_sampling_method='online',filter_algorithm=nlkf,proposal_approximation=montecarlo,number_of_particles=500,posterior_sampler_options=('particles',500)); estimation(order=3,posterior_sampling_method='online',filter_algorithm=nlkf,proposal_approximation=montecarlo,number_of_particles=100,posterior_sampler_options=('particles',100));
@#endif @#endif
@#if MCMC @#if MCMC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment