From 37bfa41518461c1cdee755df6057c3b67e517560 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 16 Dec 2011 17:31:10 +0100 Subject: [PATCH] ms-sbvar: replace state with regime --- ComputingTasks.cc | 12 ++++++------ DynareBison.yy | 6 +++--- DynareFlex.ll | 2 +- ParsingDriver.cc | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index b77520e6..36049ab4 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -1359,7 +1359,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li void MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) const { - OptionsList::num_options_t::const_iterator itChain, itState, itNOR, itDuration; + OptionsList::num_options_t::const_iterator itChain, itRegime, itNOR, itDuration; itChain = options_list.num_options.find("ms.chain"); if (itChain == options_list.num_options.end()) @@ -1375,15 +1375,15 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c exit(EXIT_FAILURE); } - itState = options_list.num_options.find("ms.state"); + itRegime = options_list.num_options.find("ms.regime"); itNOR = options_list.num_options.find("ms.number_of_regimes"); - if (itState != options_list.num_options.end() + if (itRegime != options_list.num_options.end() && itNOR == options_list.num_options.end()) - output << "options_.ms.ms_chain(" << itChain->second << ").state(" << itState->second << ").duration = " << itDuration->second << ";" << endl; - else if (itState == options_list.num_options.end() + output << "options_.ms.ms_chain(" << itChain->second << ").regime(" << itRegime->second << ").duration = " << itDuration->second << ";" << endl; + else if (itRegime == options_list.num_options.end() && itNOR != options_list.num_options.end()) for (int i = 0; i < atoi(itNOR->second.c_str()); i++) - output << "options_.ms.ms_chain(" << itChain->second << ").state(" << i+1 << ").duration = " << itDuration->second << ";" << endl; + output << "options_.ms.ms_chain(" << itChain->second << ").regime(" << i+1 << ").duration = " << itDuration->second << ";" << endl; else { cerr << "MarkovSwitchingStatement::writeOutput() Should not arrive here (3). Please report this to the Dynare Team." << endl; diff --git a/DynareBison.yy b/DynareBison.yy index ef3a2b98..1956931f 100644 --- a/DynareBison.yy +++ b/DynareBison.yy @@ -156,7 +156,7 @@ class ParsingDriver; %token SBVAR TREND_VAR DEFLATOR GROWTH_FACTOR MS_IRF MS_VARIANCE_DECOMPOSITION %token MS_ESTIMATION MS_SIMULATION MS_COMPUTE_MDD MS_COMPUTE_PROBABILITIES MS_FORECAST %token SVAR_IDENTIFICATION EQUATION EXCLUSION LAG UPPER_CHOLESKY LOWER_CHOLESKY MONTHLY QUARTERLY -%token MARKOV_SWITCHING CHAIN STATE DURATION NUMBER_OF_REGIMES +%token MARKOV_SWITCHING CHAIN REGIME DURATION NUMBER_OF_REGIMES %token SVAR COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS %token EXTERNAL_FUNCTION EXT_FUNC_NAME EXT_FUNC_NARGS FIRST_DERIV_PROVIDED SECOND_DERIV_PROVIDED %token SELECTED_VARIABLES_ONLY COVA_COMPUTE SIMULATION_FILE_TAG FILE_TAG @@ -740,7 +740,7 @@ ms_options_list : ms_options_list COMMA ms_options ; ms_options : o_chain - | o_state + | o_regime | o_duration | o_number_of_regimes ; @@ -2220,7 +2220,7 @@ o_cnum : CNUM EQUAL INT_NUMBER {driver.option_num("ms.cnum",$3); }; o_k_order_solver : K_ORDER_SOLVER {driver.option_num("k_order_solver","1"); }; o_pruning : PRUNING { driver.option_num("pruning", "1"); }; o_chain : CHAIN EQUAL INT_NUMBER { driver.option_num("ms.chain",$3); }; -o_state : STATE EQUAL INT_NUMBER { driver.option_num("ms.state",$3); }; +o_regime : REGIME EQUAL INT_NUMBER { driver.option_num("ms.regime",$3); }; o_duration : DURATION EQUAL non_negative_number { driver.option_num("ms.duration",$3); } | DURATION EQUAL INF_CONSTANT diff --git a/DynareFlex.ll b/DynareFlex.ll index e2b2a170..293f9adc 100644 --- a/DynareFlex.ll +++ b/DynareFlex.ll @@ -504,7 +504,7 @@ string eofbuff; upper_cholesky {return token::UPPER_CHOLESKY;} lower_cholesky {return token::LOWER_CHOLESKY;} chain {return token::CHAIN;} -state {return token::STATE;} +regime {return token::REGIME;} number_of_regimes {return token::NUMBER_OF_REGIMES;} duration {return token::DURATION;} coefficients {return token::COEFFICIENTS;} diff --git a/ParsingDriver.cc b/ParsingDriver.cc index 6b0e65d2..a2d73eb7 100644 --- a/ParsingDriver.cc +++ b/ParsingDriver.cc @@ -1746,19 +1746,19 @@ ParsingDriver::markov_switching() else if (atoi(it0->second.c_str()) <= 0) error("The value passed to the chain option must be greater than zero."); - it0 = options_list.num_options.find("ms.state"); + it0 = options_list.num_options.find("ms.regime"); it1 = options_list.num_options.find("ms.number_of_regimes"); if ((it0 == options_list.num_options.end()) && (it1 == options_list.num_options.end())) - error("Either a state option or a number_of_regimes option must be passed to the markov_switching statement."); + error("Either a regime option or a number_of_regimes option must be passed to the markov_switching statement."); if ((it0 != options_list.num_options.end()) && (it1 != options_list.num_options.end())) - error("You cannot pass both a state option and a number_of_regimes option to the markov_switching statement."); + error("You cannot pass both a regime option and a number_of_regimes option to the markov_switching statement."); if (it0 != options_list.num_options.end()) if (atoi(it0->second.c_str()) <= 0) - error("The value passed to the state option must be greater than zero."); + error("The value passed to the regime option must be greater than zero."); if (it1 != options_list.num_options.end()) if (atoi(it1->second.c_str()) <= 0)