v4: added forecast, updated dynare_m.exe
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1812 ac1d8469-bf42-47a9-8791-bf33cf982152issue#70
parent
25b93ed5b7
commit
b5089f2086
|
@ -164,6 +164,32 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
output << "info = stoch_simul(var_list_);\n";
|
output << "info = stoch_simul(var_list_);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ForecastStatement::ForecastStatement(const SymbolList &symbol_list_arg,
|
||||||
|
const OptionsList &options_list_arg) :
|
||||||
|
symbol_list(symbol_list_arg),
|
||||||
|
options_list(options_list_arg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ForecastStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
|
{
|
||||||
|
mod_file_struct.stoch_simul_or_similar_present = true;
|
||||||
|
|
||||||
|
// Fill in option_order of mod_file_struct
|
||||||
|
OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order");
|
||||||
|
if (it != options_list.num_options.end())
|
||||||
|
mod_file_struct.order_option = max(mod_file_struct.order_option,atoi(it->second.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ForecastStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
|
{
|
||||||
|
options_list.writeOutput(output);
|
||||||
|
symbol_list.writeOutput("var_list_", output);
|
||||||
|
output << "info = forecast(var_list_,'simul');\n";
|
||||||
|
}
|
||||||
|
|
||||||
RamseyPolicyStatement::RamseyPolicyStatement(const SymbolList &symbol_list_arg,
|
RamseyPolicyStatement::RamseyPolicyStatement(const SymbolList &symbol_list_arg,
|
||||||
const OptionsList &options_list_arg) :
|
const OptionsList &options_list_arg) :
|
||||||
symbol_list(symbol_list_arg),
|
symbol_list(symbol_list_arg),
|
||||||
|
|
|
@ -189,6 +189,7 @@ statement : declaration
|
||||||
| bvar_forecast
|
| bvar_forecast
|
||||||
| dynare_sensitivity
|
| dynare_sensitivity
|
||||||
| homotopy_setup
|
| homotopy_setup
|
||||||
|
| forecast
|
||||||
;
|
;
|
||||||
|
|
||||||
declaration : parameters
|
declaration : parameters
|
||||||
|
@ -1276,6 +1277,20 @@ homotopy_item : NAME COMMA expression COMMA expression ';'
|
||||||
{ driver.homotopy_val($1, NULL, $3);}
|
{ driver.homotopy_val($1, NULL, $3);}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
forecast: FORECAST ';' {driver.forecast();}
|
||||||
|
| FORECAST '(' forecast_options ')' ';' {driver.forecast();}
|
||||||
|
| FORECAST symbol_list ';' {driver.forecast();}
|
||||||
|
| FORECAST '(' forecast_options ')' symbol_list ';' {driver.forecast();}
|
||||||
|
;
|
||||||
|
|
||||||
|
forecast_options: forecast_option
|
||||||
|
| forecast_options COMMA forecast_option
|
||||||
|
;
|
||||||
|
|
||||||
|
forecast_option: o_periods
|
||||||
|
| o_conf_sig
|
||||||
|
;
|
||||||
|
|
||||||
number : INT_NUMBER
|
number : INT_NUMBER
|
||||||
| FLOAT_NUMBER
|
| FLOAT_NUMBER
|
||||||
;
|
;
|
||||||
|
|
|
@ -130,6 +130,7 @@ int sigma_e = 0;
|
||||||
<INITIAL>bvar_forecast {BEGIN DYNARE_STATEMENT; return token::BVAR_FORECAST; }
|
<INITIAL>bvar_forecast {BEGIN DYNARE_STATEMENT; return token::BVAR_FORECAST; }
|
||||||
<INITIAL>dynare_sensitivity {BEGIN DYNARE_STATEMENT; return token::DYNARE_SENSITIVITY;}
|
<INITIAL>dynare_sensitivity {BEGIN DYNARE_STATEMENT; return token::DYNARE_SENSITIVITY;}
|
||||||
<INITIAL>initval_file {BEGIN DYNARE_STATEMENT; return token::INITVAL_FILE;}
|
<INITIAL>initval_file {BEGIN DYNARE_STATEMENT; return token::INITVAL_FILE;}
|
||||||
|
<INITIAL>forecast {BEGIN DYNARE_STATEMENT; return token::FORECAST;}
|
||||||
/* End of a Dynare statement */
|
/* End of a Dynare statement */
|
||||||
|
|
||||||
<DYNARE_STATEMENT>; {
|
<DYNARE_STATEMENT>; {
|
||||||
|
|
|
@ -350,6 +350,14 @@ ParsingDriver::homotopy_val(string *name, NodeID val1, NodeID val2)
|
||||||
delete name;
|
delete name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ParsingDriver::forecast()
|
||||||
|
{
|
||||||
|
mod_file->addStatement(new ForecastStatement(symbol_list, options_list));
|
||||||
|
symbol_list.clear();
|
||||||
|
options_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::use_dll()
|
ParsingDriver::use_dll()
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,6 +88,18 @@ public:
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ForecastStatement : public Statement
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
const SymbolList symbol_list;
|
||||||
|
const OptionsList options_list;
|
||||||
|
public:
|
||||||
|
ForecastStatement(const SymbolList &symbol_list_arg,
|
||||||
|
const OptionsList &options_list_arg);
|
||||||
|
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||||
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
|
};
|
||||||
|
|
||||||
class RamseyPolicyStatement : public Statement
|
class RamseyPolicyStatement : public Statement
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -304,6 +304,8 @@ public:
|
||||||
void optim_options_num(string *name, string *value);
|
void optim_options_num(string *name, string *value);
|
||||||
//! Prints varops instructions
|
//! Prints varops instructions
|
||||||
void set_varobs();
|
void set_varobs();
|
||||||
|
//! Forecast Statement
|
||||||
|
void forecast();
|
||||||
void set_trends();
|
void set_trends();
|
||||||
void set_trend_element(string *arg1, NodeID arg2);
|
void set_trend_element(string *arg1, NodeID arg2);
|
||||||
void set_unit_root_vars();
|
void set_unit_root_vars();
|
||||||
|
|
Loading…
Reference in New Issue