ms-sbvar: replace state with regime
parent
f9f745716d
commit
37bfa41518
|
@ -1359,7 +1359,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li
|
||||||
void
|
void
|
||||||
MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) const
|
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");
|
itChain = options_list.num_options.find("ms.chain");
|
||||||
if (itChain == options_list.num_options.end())
|
if (itChain == options_list.num_options.end())
|
||||||
|
@ -1375,15 +1375,15 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c
|
||||||
exit(EXIT_FAILURE);
|
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");
|
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())
|
&& itNOR == options_list.num_options.end())
|
||||||
output << "options_.ms.ms_chain(" << itChain->second << ").state(" << itState->second << ").duration = " << itDuration->second << ";" << endl;
|
output << "options_.ms.ms_chain(" << itChain->second << ").regime(" << itRegime->second << ").duration = " << itDuration->second << ";" << endl;
|
||||||
else if (itState == options_list.num_options.end()
|
else if (itRegime == options_list.num_options.end()
|
||||||
&& itNOR != options_list.num_options.end())
|
&& itNOR != options_list.num_options.end())
|
||||||
for (int i = 0; i < atoi(itNOR->second.c_str()); i++)
|
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
|
else
|
||||||
{
|
{
|
||||||
cerr << "MarkovSwitchingStatement::writeOutput() Should not arrive here (3). Please report this to the Dynare Team." << endl;
|
cerr << "MarkovSwitchingStatement::writeOutput() Should not arrive here (3). Please report this to the Dynare Team." << endl;
|
||||||
|
|
|
@ -156,7 +156,7 @@ class ParsingDriver;
|
||||||
%token SBVAR TREND_VAR DEFLATOR GROWTH_FACTOR MS_IRF MS_VARIANCE_DECOMPOSITION
|
%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 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 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 SVAR COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS
|
||||||
%token EXTERNAL_FUNCTION EXT_FUNC_NAME EXT_FUNC_NARGS FIRST_DERIV_PROVIDED SECOND_DERIV_PROVIDED
|
%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
|
%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
|
ms_options : o_chain
|
||||||
| o_state
|
| o_regime
|
||||||
| o_duration
|
| o_duration
|
||||||
| o_number_of_regimes
|
| 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_k_order_solver : K_ORDER_SOLVER {driver.option_num("k_order_solver","1"); };
|
||||||
o_pruning : PRUNING { driver.option_num("pruning", "1"); };
|
o_pruning : PRUNING { driver.option_num("pruning", "1"); };
|
||||||
o_chain : CHAIN EQUAL INT_NUMBER { driver.option_num("ms.chain",$3); };
|
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
|
o_duration : DURATION EQUAL non_negative_number
|
||||||
{ driver.option_num("ms.duration",$3); }
|
{ driver.option_num("ms.duration",$3); }
|
||||||
| DURATION EQUAL INF_CONSTANT
|
| DURATION EQUAL INF_CONSTANT
|
||||||
|
|
|
@ -504,7 +504,7 @@ string eofbuff;
|
||||||
<DYNARE_STATEMENT,DYNARE_BLOCK>upper_cholesky {return token::UPPER_CHOLESKY;}
|
<DYNARE_STATEMENT,DYNARE_BLOCK>upper_cholesky {return token::UPPER_CHOLESKY;}
|
||||||
<DYNARE_STATEMENT,DYNARE_BLOCK>lower_cholesky {return token::LOWER_CHOLESKY;}
|
<DYNARE_STATEMENT,DYNARE_BLOCK>lower_cholesky {return token::LOWER_CHOLESKY;}
|
||||||
<DYNARE_STATEMENT>chain {return token::CHAIN;}
|
<DYNARE_STATEMENT>chain {return token::CHAIN;}
|
||||||
<DYNARE_STATEMENT>state {return token::STATE;}
|
<DYNARE_STATEMENT>regime {return token::REGIME;}
|
||||||
<DYNARE_STATEMENT>number_of_regimes {return token::NUMBER_OF_REGIMES;}
|
<DYNARE_STATEMENT>number_of_regimes {return token::NUMBER_OF_REGIMES;}
|
||||||
<DYNARE_STATEMENT>duration {return token::DURATION;}
|
<DYNARE_STATEMENT>duration {return token::DURATION;}
|
||||||
<DYNARE_STATEMENT>coefficients {return token::COEFFICIENTS;}
|
<DYNARE_STATEMENT>coefficients {return token::COEFFICIENTS;}
|
||||||
|
|
|
@ -1746,19 +1746,19 @@ ParsingDriver::markov_switching()
|
||||||
else if (atoi(it0->second.c_str()) <= 0)
|
else if (atoi(it0->second.c_str()) <= 0)
|
||||||
error("The value passed to the chain option must be greater than zero.");
|
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");
|
it1 = options_list.num_options.find("ms.number_of_regimes");
|
||||||
if ((it0 == options_list.num_options.end())
|
if ((it0 == options_list.num_options.end())
|
||||||
&& (it1 == 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())
|
if ((it0 != options_list.num_options.end())
|
||||||
&& (it1 != 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 (it0 != options_list.num_options.end())
|
||||||
if (atoi(it0->second.c_str()) <= 0)
|
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 (it1 != options_list.num_options.end())
|
||||||
if (atoi(it1->second.c_str()) <= 0)
|
if (atoi(it1->second.c_str()) <= 0)
|
||||||
|
|
Loading…
Reference in New Issue