var_estimation: add datafile option
parent
563d992a7a
commit
d5b1e2e317
|
@ -236,15 +236,27 @@ VarModelStatement::createVarModelMFunction(ostream &output, const map<string, se
|
|||
output << ");" << endl;
|
||||
}
|
||||
|
||||
VarEstimationStatement::VarEstimationStatement(const string &var_model_name_arg) :
|
||||
var_model_name(var_model_name_arg)
|
||||
VarEstimationStatement::VarEstimationStatement(const OptionsList &options_list_arg) :
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
VarEstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
OptionsList::string_options_t::const_iterator it = options_list.string_options.find("var_estimation.model_name");
|
||||
if (it == options_list.string_options.end())
|
||||
{
|
||||
cerr << "ERROR: You must provide the model name to the var_estimation statement." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VarEstimationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
output << "oo_ = var_estimation('" << var_model_name << "', M_, options_, oo_);" << endl;
|
||||
options_list.writeOutput(output);
|
||||
output << "oo_ = var_estimation(M_, options_, oo_);" << endl;
|
||||
}
|
||||
|
||||
VarRestrictionsStatement::VarRestrictionsStatement(const string &var_model_name_arg,
|
||||
|
|
|
@ -151,9 +151,10 @@ public:
|
|||
class VarEstimationStatement : public Statement
|
||||
{
|
||||
private:
|
||||
const string &var_model_name;
|
||||
const OptionsList options_list;
|
||||
public:
|
||||
VarEstimationStatement(const string &var_model_name_arg);
|
||||
VarEstimationStatement(const OptionsList &options_list_arg);
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -452,10 +452,17 @@ restriction_exclusion_equation : EQUATION '(' symbol ')' symbol_list ';'
|
|||
{ driver.add_VAR_restriction_exclusion_equation($3); }
|
||||
;
|
||||
|
||||
var_estimation : VAR_ESTIMATION '(' symbol ')' ';'
|
||||
{ driver.run_var_estimation($3); }
|
||||
var_estimation : VAR_ESTIMATION '(' var_estimation_options_list ')' ';'
|
||||
{ driver.run_var_estimation(); }
|
||||
;
|
||||
|
||||
var_estimation_options_list : var_estimation_options_list COMMA var_estimation_options
|
||||
| var_estimation_options
|
||||
;
|
||||
|
||||
var_estimation_options : o_var_datafile
|
||||
| o_var_model_name
|
||||
;
|
||||
|
||||
nonstationary_var_list : nonstationary_var_list symbol
|
||||
{ driver.declare_nonstationary_var($2); }
|
||||
|
@ -2995,6 +3002,8 @@ o_var_nobs : NOBS EQUAL INT_NUMBER { driver.option_num("var.nobs", $3); };
|
|||
o_var_method : METHOD EQUAL symbol { driver.option_num("var.method", $3); };
|
||||
o_series : SERIES EQUAL symbol { driver.option_str("series", $3); };
|
||||
o_datafile : DATAFILE EQUAL filename { driver.option_str("datafile", $3); };
|
||||
o_var_datafile : DATAFILE EQUAL filename { driver.option_str("var_estimation.datafile", $3); };
|
||||
o_var_model_name : symbol { driver.option_str("var_estimation.model_name", $1); };
|
||||
o_dirname : DIRNAME EQUAL filename { driver.option_str("dirname", $3); };
|
||||
o_huge_number : HUGE_NUMBER EQUAL non_negative_number { driver.option_num("huge_number", $3); };
|
||||
o_nobs : NOBS EQUAL vec_int
|
||||
|
|
|
@ -625,9 +625,9 @@ ParsingDriver::add_VAR_covariance_pair_restriction(string *name11, string *name1
|
|||
}
|
||||
|
||||
void
|
||||
ParsingDriver::run_var_estimation(string *model_name)
|
||||
ParsingDriver::run_var_estimation()
|
||||
{
|
||||
mod_file->addStatement(new VarEstimationStatement(*model_name));
|
||||
mod_file->addStatement(new VarEstimationStatement(options_list));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -793,7 +793,7 @@ public:
|
|||
void add_VAR_covariance_number_restriction(string *name1, string *name2, string *valuestr);
|
||||
void add_VAR_covariance_pair_restriction(string *name11, string *name12, string *name21, string *name22);
|
||||
//! Runs VAR estimation process
|
||||
void run_var_estimation(string *model_name);
|
||||
void run_var_estimation();
|
||||
};
|
||||
|
||||
#endif // ! PARSING_DRIVER_HH
|
||||
|
|
Loading…
Reference in New Issue