estimated_params: fixes for new semantics

The change implemented in 21a8a5794a broke the
testsuite and was incomplete.

– new option “overwrite” to provide the old behaviour (used to fix the testsuite);
– when concatenating several “estimated_params” block, the preprocessor now
  checks that paramateres are not declared twice across blocks.
pac-components
Sébastien Villemot 2021-12-16 15:36:23 +01:00
parent 4dc60e69b2
commit 4db2899868
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
8 changed files with 21 additions and 17 deletions

View File

@ -5276,6 +5276,7 @@ block decomposition of the model (see :opt:`block`).
end;
.. block:: estimated_params ;
estimated_params (overwrite) ;
|br| This block lists all parameters to be estimated and specifies
bounds and priors as necessary.
@ -5465,8 +5466,14 @@ block decomposition of the model (see :opt:`block`).
end;
It is possible to have several ``estimated_params`` blocks, in which case
they will be concatenated.
It is possible to have several ``estimated_params`` blocks. By default,
subsequent blocks are concatenated with the previous ones; this can be
useful when building models in a modular fashion (see also
:bck:`estimated_params_remove` for that use case). However, if an
``estimated_params`` block has the ``overwrite`` option, its contents
becomes the new list of estimated parameters, cancelling previous blocks;
this can be useful when doing several estimations in a single ``.mod``
file.
.. block:: estimated_params_init ;
estimated_params_init (OPTIONS...);

@ -1 +1 @@
Subproject commit 5ffbc5bad31c306f561d673cde36d460cb5906c1
Subproject commit 7dde09169ecd4b5e32b3cd35bef88958a262ec11

View File

@ -158,7 +158,7 @@ estimation(order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_c
estimated_params;
estimated_params(overwrite);
//alp, beta_pdf, 0.356, 0.02;
gam, normal_pdf, 0.0085, 0.003;
//del, beta_pdf, 0.01, 0.005;

View File

@ -101,7 +101,7 @@ if abs(fval_ML_1-fval_ML_2)>1e-5 || abs(fval_ML_1-fval_ML_3)>1e-5
end
options_.debug=0;
estimated_params;
estimated_params(overwrite);
alp, beta_pdf, 0.356, 0.02;
rho, beta_pdf, 0.129, 0.100;
psi, beta_pdf, 0.65, 0.05;

View File

@ -46,10 +46,8 @@ end;
@#for estimParams in [0, 1, 2]
clear estim_params_;
@#if estimParams == 0
estimated_params;
estimated_params(overwrite);
%DELTA, 0.025;
%BETTA, 0.984;
%B, 0.5;
@ -61,7 +59,7 @@ end;
@#endif
@#if estimParams == 1
estimated_params;
estimated_params(overwrite);
%DELTA, , 0, 1;
%BETTA, , 0, 1;
%B, , 0, 1;
@ -73,7 +71,7 @@ end;
@#endif
@#if estimParams == 2
estimated_params;
estimated_params(overwrite);
%DELTA, 0.025, 0, 1, normal_pdf, 0.02, 0.5;
%BETTA, 0.98, 0, 1, beta_pdf, 0.90, 0.25;
%B, 0.45, 0, 1, normal_pdf, 0.40, 0.5;
@ -122,4 +120,4 @@ end;
@#endif
@#endfor
@#endfor
@#endfor

View File

@ -72,9 +72,8 @@ options_.solveopt.TolXConstraint=1e-3;
@#for estimParams in [0, 1, 2]
clear estim_params_;
@#if estimParams == 0
estimated_params;
estimated_params(overwrite);
%DELTA, 0.025;
%BETTA, 0.984;
%B, 0.5;
@ -87,7 +86,7 @@ options_.solveopt.TolXConstraint=1e-3;
@#endif
@#if estimParams == 1
estimated_params;
estimated_params(overwrite);
%DELTA, , 0, 1;
%BETTA, , 0, 1;
%B, , 0, 1;
@ -100,7 +99,7 @@ options_.solveopt.TolXConstraint=1e-3;
@#endif
@#if estimParams == 2
estimated_params;
estimated_params(overwrite);
%DELTA, 0.025, 0, 1, normal_pdf, 0.02, 0.5;
%BETTA, 0.98, 0, 1, beta_pdf, 0.90, 0.25;
%B, 0.45, 0, 1, normal_pdf, 0.40, 0.5;

View File

@ -116,7 +116,7 @@ estimation(order=1,datafile=fsdat_simul,mode_check,smoother,filter_decomposition
estimated_params;
estimated_params(overwrite);
//alp, beta_pdf, 0.356, 0.02;
gam, normal_pdf, 0.0085, 0.003;
//del, beta_pdf, 0.01, 0.005;

View File

@ -181,7 +181,7 @@ for var_iter_1=1:nvars
end
// case with measurement error
estimated_params;
estimated_params(overwrite);
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;