Added filter_algorithm (estimation command, sets the particle filter algorithm).
parent
bcad4f31f2
commit
5e4b7d8d42
|
@ -5329,6 +5329,28 @@ A real number between zero and one. The resampling step is triggered as soon as
|
|||
@anchor{resampling_method}
|
||||
Sets the resampling method. Possible values for @var{OPTION} are: @code{kitagawa}, @code{stratified} and @code{smooth}.
|
||||
|
||||
@item filter_algorithm = @var{OPTION}
|
||||
@anchor{resampling}
|
||||
Sets the particle filter algorithm. Possible values for @var{OPTION} are:
|
||||
|
||||
@table @code
|
||||
|
||||
@item sis
|
||||
Sequential importance sampling algorithm, this is the default value.
|
||||
|
||||
@item apf
|
||||
Auxiliary particle filter.
|
||||
|
||||
@item gf
|
||||
Gaussian filter.
|
||||
|
||||
@item gmf
|
||||
Gaussian mixture filter.
|
||||
|
||||
@item cpf
|
||||
Conditional particle filter.
|
||||
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
|
|
|
@ -71,6 +71,27 @@ end
|
|||
if ~options_.dsge_var
|
||||
if options_.particle.status
|
||||
objective_function = str2func('non_linear_dsge_likelihood');
|
||||
if options_.particle.filter_algorithm.sis == 1
|
||||
options_.particle.algorithm = 'sequential_importance_particle_filter';
|
||||
else
|
||||
if options_.particle.filter_algorithm.apf == 1
|
||||
options_.particle.algorithm = 'auxiliary_particle_filter';
|
||||
else
|
||||
if options_.particle.filter_algorithm.gf == 1
|
||||
options_.particle.algorithm = 'gaussian_filter';
|
||||
else
|
||||
if options_.particle.filter_algorithm.gmf == 1
|
||||
options_.particle.algorithm = 'gaussian_mixture_filter';
|
||||
else
|
||||
if options_.particle.filter_algorithm.cpf == 1
|
||||
options_.particle.algorithm = 'conditional_particle_filter';
|
||||
else
|
||||
error('Estimation: Unknown filter!')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
objective_function = str2func('dsge_likelihood');
|
||||
end
|
||||
|
|
|
@ -225,8 +225,6 @@ particle.number_of_particles = 5000;
|
|||
particle.smolyak_accuracy = 3;
|
||||
% By default we don't use pruning
|
||||
particle.pruning = 0;
|
||||
% Set default algorithm
|
||||
particle.algorithm = 'sequential_importance_particle_filter';
|
||||
% Set the Gaussian approximation method for Importance sampling
|
||||
particle.IS_approximation_method = 'unscented';
|
||||
% Set the Gaussian approximation method for particles distributions
|
||||
|
@ -243,6 +241,11 @@ particle.resampling.threshold = .5;
|
|||
particle.resampling.method.kitagawa = 1;
|
||||
particle.resampling.method.smooth = 0;
|
||||
particle.resampling.method.stratified = 0;
|
||||
% Set default algorithm
|
||||
particle.filter_algorithm.sis = 1;
|
||||
particle.filter_algorithm.apf = 0;
|
||||
particle.filter_algorithm.gmf = 0;
|
||||
particle.filter_algorithm.cpf = 0;
|
||||
% Number of partitions for the smoothed resampling method
|
||||
particle.resampling.number_of_partitions = 200;
|
||||
% Configuration of the mixture filters
|
||||
|
|
|
@ -108,6 +108,7 @@ class ParsingDriver;
|
|||
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
|
||||
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL MCMC_JUMPING_COVARIANCE MOMENT_CALIBRATION
|
||||
%token NUMBER_OF_PARTICLES RESAMPLING SYSTEMATIC GENERIC RESAMPLING_THRESHOLD RESAMPLING_METHOD KITAGAWA STRATIFIED SMOOTH
|
||||
%token FILTER_ALGORITHM SIS APF GF GMF CPF
|
||||
%token <string_val> NAME
|
||||
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS NO_HOMOTOPY
|
||||
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
|
||||
|
@ -1681,6 +1682,7 @@ estimation_options : o_datafile
|
|||
| o_resampling
|
||||
| o_resampling_threshold
|
||||
| o_resampling_method
|
||||
| o_filter_algorithm
|
||||
;
|
||||
|
||||
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
|
||||
|
@ -2651,6 +2653,12 @@ o_resampling_threshold : RESAMPLING_THRESHOLD EQUAL non_negative_number { driver
|
|||
o_resampling_method : RESAMPLING_METHOD EQUAL KITAGAWA {driver.option_num("particle.resampling.method.kitagawa", "1"); driver.option_num("particle.resampling.method.smooth", "0"); driver.option_num("particle.resampling.smethod.stratified", "0"); }
|
||||
| RESAMPLING_METHOD EQUAL SMOOTH {driver.option_num("particle.resampling.method.kitagawa", "0"); driver.option_num("particle.resampling.method.smooth", "1"); driver.option_num("particle.resampling.smethod.stratified", "0"); }
|
||||
| RESAMPLING_METHOD EQUAL STRATIFIED {driver.option_num("particle.resampling.method.kitagawa", "0"); driver.option_num("particle.resampling.method.smooth", "0"); driver.option_num("particle.resampling.method.stratified", "1"); };
|
||||
o_filter_algorithm : FILTER_ALGORITHM EQUAL SIS {driver.option_num("particle.filter_algorithm.sis", "1"); driver.option_num("particle.filter_algorithm.apf", "0"); driver.option_num("particle.filter.algorithm.gf", "0"); driver.option_num("particle.filter.algorithm.gmf", "0");driver.option_num("particle.filter.algorithm.cpf", "0");}
|
||||
| FILTER_ALGORITHM EQUAL APF {driver.option_num("particle.filter_algorithm.sis", "0"); driver.option_num("particle.filter_algorithm.apf", "1"); driver.option_num("particle.filter.algorithm.gf", "0"); driver.option_num("particle.filter.algorithm.gmf", "0"); driver.option_num("particle.filter.algorithm.cpf", "0");}
|
||||
| FILTER_ALGORITHM EQUAL GF {driver.option_num("particle.filter_algorithm.sis", "0"); driver.option_num("particle.filter_algorithm.apf", "0"); driver.option_num("particle.filter.algorithm.gf", "1"); driver.option_num("particle.filter.algorithm.gmf", "0"); driver.option_num("particle.filter.algorithm.cpf", "0");}
|
||||
| FILTER_ALGORITHM EQUAL GMF {driver.option_num("particle.filter_algorithm.sis", "0"); driver.option_num("particle.filter_algorithm.apf", "0"); driver.option_num("particle.filter.algorithm.gf", "0"); driver.option_num("particle.filter.algorithm.gmf", "1"); driver.option_num("particle.filter.algorithm.cpf", "0");}
|
||||
| FILTER_ALGORITHM EQUAL CPF {driver.option_num("particle.filter_algorithm.sis", "0"); driver.option_num("particle.filter_algorithm.apf", "0"); driver.option_num("particle.filter.algorithm.gf", "0"); driver.option_num("particle.filter.algorithm.gmf", "0"); driver.option_num("particle.filter.algorithm.cpf", "1");} ;
|
||||
|
||||
|
||||
o_gsa_identification : IDENTIFICATION EQUAL INT_NUMBER { driver.option_num("identification", $3); }; /*not in doc */
|
||||
o_gsa_morris : MORRIS EQUAL INT_NUMBER { driver.option_num("morris", $3); };
|
||||
|
|
|
@ -363,7 +363,12 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
|||
<DYNARE_STATEMENT>kitagawa {return token::KITAGAWA;}
|
||||
<DYNARE_STATEMENT>smooth {return token::SMOOTH;}
|
||||
<DYNARE_STATEMENT>stratified {return token::STRATIFIED;}
|
||||
|
||||
<DYNARE_STATEMENT>filter_algorithm {return token::FILTER_ALGORITHM;}
|
||||
<DYNARE_STATEMENT>sis {return token::SIS;}
|
||||
<DYNARE_STATEMENT>apf {return token::APF;}
|
||||
<DYNARE_STATEMENT>gf {return token::GF;}
|
||||
<DYNARE_STATEMENT>gmf {return token::GMF;}
|
||||
<DYNARE_STATEMENT>cpf {return token::CPF;}
|
||||
|
||||
<DYNARE_STATEMENT>alpha {
|
||||
yylval->string_val = new string(yytext);
|
||||
|
|
Loading…
Reference in New Issue