ms-sbvar: replaced number_of_states with number_of_regimes
parent
16bf5c7642
commit
16e11d49df
|
@ -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, itNOS, itDuration;
|
OptionsList::num_options_t::const_iterator itChain, itState, 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())
|
||||||
|
@ -1376,13 +1376,13 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c
|
||||||
}
|
}
|
||||||
|
|
||||||
itState = options_list.num_options.find("ms.state");
|
itState = options_list.num_options.find("ms.state");
|
||||||
itNOS = options_list.num_options.find("ms.number_of_states");
|
itNOR = options_list.num_options.find("ms.number_of_regimes");
|
||||||
if (itState != options_list.num_options.end()
|
if (itState != options_list.num_options.end()
|
||||||
&& itNOS == 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 << ").state(" << itState->second << ").duration = " << itDuration->second << ";" << endl;
|
||||||
else if (itState == options_list.num_options.end()
|
else if (itState == options_list.num_options.end()
|
||||||
&& itNOS != options_list.num_options.end())
|
&& itNOR != options_list.num_options.end())
|
||||||
for (int i = 0; i < atoi(itNOS->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 << ").state(" << i+1 << ").duration = " << itDuration->second << ";" << endl;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -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_STATES
|
%token MARKOV_SWITCHING CHAIN STATE 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
|
||||||
|
@ -742,7 +742,7 @@ ms_options_list : ms_options_list COMMA ms_options
|
||||||
ms_options : o_chain
|
ms_options : o_chain
|
||||||
| o_state
|
| o_state
|
||||||
| o_duration
|
| o_duration
|
||||||
| o_number_of_states
|
| o_number_of_regimes
|
||||||
;
|
;
|
||||||
|
|
||||||
svar : SVAR '(' svar_options_list ')' ';'
|
svar : SVAR '(' svar_options_list ')' ';'
|
||||||
|
@ -2226,7 +2226,7 @@ o_duration : DURATION EQUAL non_negative_number
|
||||||
| DURATION EQUAL INF_CONSTANT
|
| DURATION EQUAL INF_CONSTANT
|
||||||
{ driver.option_num("ms.duration","Inf"); }
|
{ driver.option_num("ms.duration","Inf"); }
|
||||||
;
|
;
|
||||||
o_number_of_states : NUMBER_OF_STATES EQUAL INT_NUMBER { driver.option_num("ms.number_of_states",$3); };
|
o_number_of_regimes : NUMBER_OF_REGIMES EQUAL INT_NUMBER { driver.option_num("ms.number_of_regimes",$3); };
|
||||||
o_coefficients : COEFFICIENTS { driver.option_str("ms.coefficients","svar_coefficients"); };
|
o_coefficients : COEFFICIENTS { driver.option_str("ms.coefficients","svar_coefficients"); };
|
||||||
o_variances : VARIANCES { driver.option_str("ms.variances","svar_variances"); };
|
o_variances : VARIANCES { driver.option_str("ms.variances","svar_variances"); };
|
||||||
o_equations : EQUATIONS EQUAL vec_int
|
o_equations : EQUATIONS EQUAL vec_int
|
||||||
|
|
|
@ -505,7 +505,7 @@ string eofbuff;
|
||||||
<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>state {return token::STATE;}
|
||||||
<DYNARE_STATEMENT>number_of_states {return token::NUMBER_OF_STATES;}
|
<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;}
|
||||||
<DYNARE_STATEMENT>variances {return token::VARIANCES;}
|
<DYNARE_STATEMENT>variances {return token::VARIANCES;}
|
||||||
|
|
|
@ -1747,14 +1747,14 @@ ParsingDriver::markov_switching()
|
||||||
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.state");
|
||||||
it1 = options_list.num_options.find("ms.number_of_states");
|
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_states option must be passed to the markov_switching statement.");
|
error("Either a state 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_states option to the markov_switching statement.");
|
error("You cannot pass both a state 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)
|
||||||
|
@ -1762,7 +1762,7 @@ ParsingDriver::markov_switching()
|
||||||
|
|
||||||
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)
|
||||||
error("The value passed to the number_of_states option must be greater than zero.");
|
error("The value passed to the number_of_regimes option must be greater than zero.");
|
||||||
|
|
||||||
string infStr("Inf");
|
string infStr("Inf");
|
||||||
it0 = options_list.num_options.find("ms.duration");
|
it0 = options_list.num_options.find("ms.duration");
|
||||||
|
|
|
@ -6,7 +6,7 @@ svar_identification;
|
||||||
lower_cholesky;
|
lower_cholesky;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
markov_switching(chain=1,number_of_states=2,duration=2.5);
|
markov_switching(chain=1,number_of_regimes=2,duration=2.5);
|
||||||
|
|
||||||
svar(variances, chain=1);
|
svar(variances, chain=1);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ svar_identification;
|
||||||
lower_cholesky;
|
lower_cholesky;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
markov_switching(chain=1,number_of_states=2,duration=2.5);
|
markov_switching(chain=1,number_of_regimes=2,duration=2.5);
|
||||||
|
|
||||||
svar(variances, chain=1);
|
svar(variances, chain=1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue