Commit ec9b4742 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added an option for the threshold level of neff in the generic case of the resampling routines.

parent 2e6762eb
......@@ -179,7 +179,8 @@ particle.unscented.alpha = 1;
particle.unscented.beta = 2;
particle.unscented.kappa = 1;
% Configuration of resampling in case of particles
particle.resampling.status = 'systematic' ;
particle.resampling.status = 'systematic'; % 'generic'
particle.resampling.neff_threshold = .5;
% Choice of the resampling method
particle.resampling.method1 = 'traditional' ;
particle.resampling.method2 = 'kitagawa';
......
......@@ -131,7 +131,7 @@ for t=1:sample_size
lik(t) = log(mean(wtilde))+dfac;
weights = wtilde/sum(wtilde);
Neff = 1/(weights*weights');
if (Neff<.5*sample_size && strcmpi(DynareOptions.particle.resampling.status,'generic')) || strcmpi(DynareOptions.particle.resampling.status,'systematic')
if (Neff<DynareOptions.particle.resampling.neff_threshold*sample_size && strcmpi(DynareOptions.particle.resampling.status,'generic')) || strcmpi(DynareOptions.particle.resampling.status,'systematic')
nb_obs_resamp = nb_obs_resamp+1 ;
StateVectors = tmp(mf0,resample(weights,DynareOptions.particle.resampling.method1,DynareOptions.particle.resampling.method2));
weights = ones(1,number_of_particles)/number_of_particles ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment