v4: prior_analysis, again

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1098 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
michel 2006-11-25 17:55:02 +00:00
parent de7e3fdfac
commit f2b1f68e75
6 changed files with 78 additions and 0 deletions

View File

@ -81,6 +81,20 @@ void ComputingTasks::runEstimation(string tmp1)
*output << "dynare_estimation(var_list_);\n";
}
//------------------------------------------------------------------------------
void ComputingTasks::runPriorAnalysis(string tmp1)
{
*output << tmp1;
*output << "prior_analysis(var_list_);\n";
}
//------------------------------------------------------------------------------
void ComputingTasks::runPosteriorAnalysis(string tmp1)
{
*output << tmp1;
*output << "posterior_analysis(var_list_);\n";
}
//------------------------------------------------------------------------------
void ComputingTasks::runRplot(string tmp1)
{

View File

@ -43,6 +43,7 @@ typedef pair<int, Type> ExpObj;
%token CALIB CALIB_VAR CHECK CONF_SIG CORR COVAR
%token DATAFILE DIAGNOSTIC DIFFUSE_D DOLLAR DR_ALGO DROP DSAMPLE DYN2VEC DYNASAVE DYNATYPE
%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT
%token PRIOR_ANALYSIS POSTERIOR_ANALYSIS
%token FILTERED_VARS FIRST_OBS
%token <string_val> FLOAT_NUMBER
%token FORECAST FUNCTIONS
@ -108,6 +109,8 @@ typedef pair<int, Type> ExpObj;
| simul
| stoch_simul
| estimation
| prior_analysis
| posterior_analysis
| estimated_params
| estimated_params_bounds
| estimated_params_init
@ -876,6 +879,41 @@ typedef pair<int, Type> ExpObj;
| o_noconstant
;
prior_analysis
: PRIOR_ANALYSIS '(' prior_posterior_options_list ')' ';'
{driver.run_prior_analysis();}
| PRIOR_ANALYSIS '(' prior_posterior_options_list ')' tmp_var_list ';'
{driver.run_prior_analysis();}
;
prior_posterior_options_list
: prior_posterior_options_list COMMA prior_posterior_options
| prior_posterior_options
;
prior_posterior_options
: o_nograph
| o_conf_sig
| o_prior_trunc
| o_bayesian_irf
| o_irf
| o_tex
| o_forecast
| o_smoother
| o_moments_varendo
| o_filtered_vars
| o_xls_sheet
| o_xls_range
| o_filter_step_ahead
;
posterior_analysis
: POSTERIOR_ANALYSIS '(' prior_posterior_options_list ')' ';'
{driver.run_posterior_analysis();}
| POSTERIOR_ANALYSIS '(' prior_posterior_options_list ')' tmp_var_list ';'
{driver.run_posterior_analysis();}
;
list_optim_option
: '\'' NAME '\'' COMMA '\'' NAME '\'' {driver.optim_options($2, $6, 2);}
| '\'' NAME '\'' COMMA value {driver.optim_options($2, $5, 2);}

View File

@ -63,6 +63,8 @@ int sigma_e = 0;
<INITIAL>periods {BEGIN DYNARE_STATEMENT; return token::PERIODS;}
<INITIAL>initvalf {BEGIN DYNARE_STATEMENT; return token::INITVALF;}
<INITIAL>estimation {BEGIN DYNARE_STATEMENT; return token::ESTIMATION;}
<INITIAL>prior_analysis {BEGIN DYNARE_STATEMENT; return token::PRIOR_ANALYSIS;}
<INITIAL>posterior_analysis {BEGIN DYNARE_STATEMENT; return token::POSTERIOR_ANALYSIS;}
<INITIAL>varobs {BEGIN DYNARE_STATEMENT; return token::VAROBS;}
<INITIAL>unit_root_vars {BEGIN DYNARE_STATEMENT; return token::UNIT_ROOT_VARS;}
<INITIAL>dyn2vec {BEGIN DYNARE_STATEMENT; return token::DYN2VEC;}
@ -98,6 +100,8 @@ int sigma_e = 0;
<INITIAL>histval {BEGIN DYNARE_BLOCK; return token::HISTVAL;}
<INITIAL>shocks {BEGIN DYNARE_BLOCK; return token::SHOCKS;}
<INITIAL>estimated_params {BEGIN DYNARE_BLOCK; return token::ESTIMATED_PARAMS;}
/* priors is an alias for estimated_params */
<INITIAL>priors {BEGIN DYNARE_BLOCK;return token::ESTIMATED_PARAMS;}
<INITIAL>estimated_params_init {BEGIN DYNARE_BLOCK; return token::ESTIMATED_PARAMS_INIT;}
<INITIAL>estimated_params_bounds {BEGIN DYNARE_BLOCK; return token::ESTIMATED_PARAMS_BOUNDS;}
<INITIAL>observation_trends {BEGIN DYNARE_BLOCK; return token::OBSERVATION_TRENDS;}

View File

@ -597,6 +597,22 @@ ParsingDriver::run_estimation()
computing_tasks.runEstimation(tmp);
}
void
ParsingDriver::run_prior_analysis()
{
tmp_symbol_table.set("var_list_");
string tmp = tmp_symbol_table.get();
computing_tasks.runPriorAnalysis(tmp);
}
void
ParsingDriver::run_posterior_analysis()
{
tmp_symbol_table.set("var_list_");
string tmp = tmp_symbol_table.get();
computing_tasks.runPosteriorAnalysis(tmp);
}
void
ParsingDriver::optim_options(string *str1, string *str2, int task)
{

View File

@ -92,6 +92,8 @@ public :
void setOption(std::string iName, std::string iValue1, std::string iValue2);
/*! Prints "dynare_estimation;" */
void runEstimation(std::string);
void runPriorAnalysis(std::string);
void runPosteriorAnalysis(std::string);
void runRplot(std::string);
/*! Prints some estimation initialisation */
void setEstimationInit(void);

View File

@ -228,6 +228,10 @@ public:
void set_estimated_bounds_elements();
//! Runs estimation process
void run_estimation();
//! Runs prior_analysis();
void run_prior_analysis();
//! Runs posterior_analysis();
void run_posterior_analysis();
//! Prints optimization options
void optim_options(string *str1, string *str2, int task);
//! Prints varops instructions