system

system —

Synopsis

enum                GretlSystemMethods;
typedef             id_atom;
typedef             identity;
typedef             predet;
typedef             liml_data;
equation_system *   equation_system_start               (const char *line,
                                                         gretlopt opt,
                                                         int *err);
char *              get_system_name_from_line           (const char *s,
                                                         int context);
int                 equation_system_append              (equation_system *sys,
                                                         const int *list);
int                 system_parse_line                   (equation_system *sys,
                                                         const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 equation_system_finalize            (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 equation_system_estimate            (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 estimate_named_system               (const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
void                equation_system_destroy             (equation_system *sys);
int                 system_want_df_corr                 (const equation_system *sys);
int                 system_n_restrictions               (const equation_system *sys);
int                 system_max_indep_vars               (const equation_system *sys);
int                 system_n_indep_vars                 (const equation_system *sys);
int *               system_get_list                     (const equation_system *sys,
                                                         int i);
int                 system_get_list_length              (const equation_system *sys,
                                                         int i);
int *               compose_ivreg_list                  (const equation_system *sys,
                                                         int i);
int                 system_get_depvar                   (const equation_system *sys,
                                                         int i);
const char *        system_short_string                 (const MODEL *pmod);
void                equation_system_set_name            (equation_system *sys,
                                                         const char *name);
int                 system_method_from_string           (const char *s);
const char *        system_method_full_string           (int method);
const char *        system_method_short_string          (int method);
int *               system_get_endog_vars               (const equation_system *sys);
int *               system_get_instr_vars               (const equation_system *sys);
void                system_attach_uhat                  (equation_system *sys,
                                                         gretl_matrix *E);
void                system_attach_sigma                 (equation_system *sys,
                                                         gretl_matrix *S);
void                system_attach_coeffs                (equation_system *sys,
                                                         gretl_matrix *b);
void                system_attach_vcv                   (equation_system *sys,
                                                         gretl_matrix *vcv);
MODEL *             system_get_model                    (const equation_system *sys,
                                                         int i);
int                 system_get_overid_df                (const equation_system *sys);
int                 system_vcv_geomean                  (const equation_system *sys);
double              system_vcv_denom                    (const equation_system *sys,
                                                         int i,
                                                         int j);
int                 rhs_var_in_identity                 (const equation_system *sys,
                                                         int lhsvar,
                                                         int rhsvar);
void                print_equation_system_info          (const equation_system *sys,
                                                         const DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
void                system_set_restriction_matrices     (equation_system *sys,
                                                         gretl_matrix *R,
                                                         gretl_matrix *q);
int                 system_normality_test               (const equation_system *sys,
                                                         PRN *prn);
int                 system_add_resids_to_dataset        (equation_system *sys,
                                                         int eqnum,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
double *            equation_system_get_series          (const equation_system *sys,
                                                         const DATAINFO *pdinfo,
                                                         int idx,
                                                         const char *key,
                                                         int *err);
gretl_matrix *      equation_system_get_matrix          (const equation_system *sys,
                                                         int idx,
                                                         int *err);
int                 highest_numbered_var_in_system      (const equation_system *sys,
                                                         const DATAINFO *pdinfo);
int                 equation_system_serialize           (equation_system *sys,
                                                         SavedObjectFlags flags,
                                                         FILE *fp);
void                system_set_save_flag                (equation_system *sys);
void                system_unset_save_flag              (equation_system *sys);
int                 system_save_flag_is_set             (equation_system *sys);
int                 gretl_system_print                  (equation_system *sys,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 system_print_sigma                  (const equation_system *sys,
                                                         PRN *prn);
const gretl_matrix * system_get_forecast_matrix         (equation_system *sys,
                                                         int t1,
                                                         int t2,
                                                         const double **Z,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         int *err);
gretl_matrix *      sys_get_fitted_values               (equation_system *sys,
                                                         int v,
                                                         int t1,
                                                         int t2,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo,
                                                         int *err);
int                 system_adjust_t1t2                  (equation_system *sys,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo);
equation_system *   equation_system_from_XML            (xmlNodePtr node,
                                                         xmlDocPtr doc,
                                                         const DATAINFO *pdinfo,
                                                         int *err);
int                 system_save_and_print_results       (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 system_autocorrelation_test         (equation_system *sys,
                                                         int order,
                                                         PRN *prn);
int                 system_arch_test                    (equation_system *sys,
                                                         int order,
                                                         PRN *prn);
MODEL               single_equation_liml                (const int *list,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);

Description

Details

enum GretlSystemMethods

typedef enum {
    SYS_METHOD_SUR = 0,
    SYS_METHOD_3SLS,
    SYS_METHOD_FIML,
    SYS_METHOD_LIML,
    SYS_METHOD_OLS,
    SYS_METHOD_TSLS,
    SYS_METHOD_WLS,
    SYS_METHOD_MAX
} GretlSystemMethods;


id_atom

typedef struct id_atom_ id_atom;


identity

typedef struct identity_ identity;


predet

typedef struct predet_ predet;


liml_data

typedef struct liml_data_ liml_data;


equation_system_start ()

equation_system *   equation_system_start               (const char *line,
                                                         gretlopt opt,
                                                         int *err);

Start compiling an equation system: line must specify a "method" (estimation method) and/or a name for the system. If a method is given, the system will be estimated as soon as its definition is complete. If a name is given, the system definition is saved on a stack, and it can subsequently be estimated via various methods If both a name and an estimation method are given, the system is both estimated and saved.

line : command line.
opt : may include OPT_I for iterative estimation, if the estimation method supports this.
err :
Returns : pointer to a new equation system, or NULL on error.

get_system_name_from_line ()

char *              get_system_name_from_line           (const char *s,
                                                         int context);

s :
context :
Returns :

equation_system_append ()

int                 equation_system_append              (equation_system *sys,
                                                         const int *list);

Adds an equation (as represented by list) to sys.

sys : initialized equation system.
list : list containing dependent variable and regressors.
Returns : 0 on success, non-zero on failure, in which case sys is destroyed.

system_parse_line ()

int                 system_parse_line                   (equation_system *sys,
                                                         const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Modifies sys according to the command supplied in line, which must start with "identity" (and supply an identity to be added to the system, or "endog" (and supply a list of endogenous variables), or "instr" (and supply a list of instrumental variables).

sys : initialized equation system.
line : command line.
pZ : pointer to dats array.
pdinfo : dataset information.
Returns : 0 on success, non-zero on failure, in which case sys is destroyed.

equation_system_finalize ()

int                 equation_system_finalize            (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

Finalize an equation system, e.g. in response to "end system". If the system has a specified name, we save it on a stack of defined systems. If it has a specified estimation method, we go ahead and estimate it. If it has both, we do both.

sys : pre-defined equation system.
pZ : pointer to data array.
pdinfo : dataset information.
opt : may include OPT_V for verbose operation, OPT_S to permit estimation of a single equation.
prn : printing struct.
Returns : 0 on success, non-zero on error. If the system is mal-formed, it is destroyed.

equation_system_estimate ()

int                 equation_system_estimate            (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

Estimate a pre-defined equation system and print the results to prn.

sys : pre-defined equation system.
pZ : pointer to data array.
pdinfo : dataset information.
opt : may include OPT_V for more verbose operation.
prn : printing struct.
Returns : 0 on success, non-zero on error.

estimate_named_system ()

int                 estimate_named_system               (const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

line :
pZ :
pdinfo :
opt :
prn :
Returns :

equation_system_destroy ()

void                equation_system_destroy             (equation_system *sys);

sys :

system_want_df_corr ()

int                 system_want_df_corr                 (const equation_system *sys);

sys :
Returns :

system_n_restrictions ()

int                 system_n_restrictions               (const equation_system *sys);

sys :
Returns :

system_max_indep_vars ()

int                 system_max_indep_vars               (const equation_system *sys);

sys :
Returns :

system_n_indep_vars ()

int                 system_n_indep_vars                 (const equation_system *sys);

sys :
Returns :

system_get_list ()

int *               system_get_list                     (const equation_system *sys,
                                                         int i);

sys :
i :
Returns :

system_get_list_length ()

int                 system_get_list_length              (const equation_system *sys,
                                                         int i);

sys :
i :
Returns :

compose_ivreg_list ()

int *               compose_ivreg_list                  (const equation_system *sys,
                                                         int i);

sys :
i :
Returns :

system_get_depvar ()

int                 system_get_depvar                   (const equation_system *sys,
                                                         int i);

sys :
i :
Returns :

system_short_string ()

const char *        system_short_string                 (const MODEL *pmod);

pmod :
Returns :

equation_system_set_name ()

void                equation_system_set_name            (equation_system *sys,
                                                         const char *name);

sys :
name :

system_method_from_string ()

int                 system_method_from_string           (const char *s);

s :
Returns :

system_method_full_string ()

const char *        system_method_full_string           (int method);

method :
Returns :

system_method_short_string ()

const char *        system_method_short_string          (int method);

method :
Returns :

system_get_endog_vars ()

int *               system_get_endog_vars               (const equation_system *sys);

sys :
Returns :

system_get_instr_vars ()

int *               system_get_instr_vars               (const equation_system *sys);

sys :
Returns :

system_attach_uhat ()

void                system_attach_uhat                  (equation_system *sys,
                                                         gretl_matrix *E);

sys :
E :

system_attach_sigma ()

void                system_attach_sigma                 (equation_system *sys,
                                                         gretl_matrix *S);

sys :
S :

system_attach_coeffs ()

void                system_attach_coeffs                (equation_system *sys,
                                                         gretl_matrix *b);

sys :
b :

system_attach_vcv ()

void                system_attach_vcv                   (equation_system *sys,
                                                         gretl_matrix *vcv);

sys :
vcv :

system_get_model ()

MODEL *             system_get_model                    (const equation_system *sys,
                                                         int i);

sys :
i :
Returns :

system_get_overid_df ()

int                 system_get_overid_df                (const equation_system *sys);

sys :
Returns :

system_vcv_geomean ()

int                 system_vcv_geomean                  (const equation_system *sys);

sys :
Returns :

system_vcv_denom ()

double              system_vcv_denom                    (const equation_system *sys,
                                                         int i,
                                                         int j);

sys :
i :
j :
Returns :

rhs_var_in_identity ()

int                 rhs_var_in_identity                 (const equation_system *sys,
                                                         int lhsvar,
                                                         int rhsvar);

sys :
lhsvar :
rhsvar :
Returns :

print_equation_system_info ()

void                print_equation_system_info          (const equation_system *sys,
                                                         const DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

Prints details of an equation system to prn.

sys : gretl equation system.
pdinfo : dataset information.
opt : use OPT_H for printing in a form designed to appear in the header when results of estimation are printed.
prn : printing struct.

system_set_restriction_matrices ()

void                system_set_restriction_matrices     (equation_system *sys,
                                                         gretl_matrix *R,
                                                         gretl_matrix *q);

sys :
R :
q :

system_normality_test ()

int                 system_normality_test               (const equation_system *sys,
                                                         PRN *prn);

sys :
prn :
Returns :

system_add_resids_to_dataset ()

int                 system_add_resids_to_dataset        (equation_system *sys,
                                                         int eqnum,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

sys :
eqnum :
pZ :
pdinfo :
Returns :

equation_system_get_series ()

double *            equation_system_get_series          (const equation_system *sys,
                                                         const DATAINFO *pdinfo,
                                                         int idx,
                                                         const char *key,
                                                         int *err);

sys :
pdinfo :
idx :
key :
err :
Returns :

equation_system_get_matrix ()

gretl_matrix *      equation_system_get_matrix          (const equation_system *sys,
                                                         int idx,
                                                         int *err);

sys :
idx :
err :
Returns :

highest_numbered_var_in_system ()

int                 highest_numbered_var_in_system      (const equation_system *sys,
                                                         const DATAINFO *pdinfo);

sys :
pdinfo :
Returns :

equation_system_serialize ()

int                 equation_system_serialize           (equation_system *sys,
                                                         SavedObjectFlags flags,
                                                         FILE *fp);

sys :
flags :
fp :
Returns :

system_set_save_flag ()

void                system_set_save_flag                (equation_system *sys);

sys :

system_unset_save_flag ()

void                system_unset_save_flag              (equation_system *sys);

sys :

system_save_flag_is_set ()

int                 system_save_flag_is_set             (equation_system *sys);

sys :
Returns :

gretl_system_print ()

int                 gretl_system_print                  (equation_system *sys,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

sys :
Z :
pdinfo :
opt :
prn :
Returns :

system_print_sigma ()

int                 system_print_sigma                  (const equation_system *sys,
                                                         PRN *prn);

sys :
prn :
Returns :

system_get_forecast_matrix ()

const gretl_matrix * system_get_forecast_matrix         (equation_system *sys,
                                                         int t1,
                                                         int t2,
                                                         const double **Z,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         int *err);

sys :
t1 :
t2 :
Z :
pdinfo :
opt :
err :
Returns :

sys_get_fitted_values ()

gretl_matrix *      sys_get_fitted_values               (equation_system *sys,
                                                         int v,
                                                         int t1,
                                                         int t2,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo,
                                                         int *err);

sys :
v :
t1 :
t2 :
Z :
pdinfo :
err :
Returns :

system_adjust_t1t2 ()

int                 system_adjust_t1t2                  (equation_system *sys,
                                                         const double **Z,
                                                         const DATAINFO *pdinfo);

sys :
Z :
pdinfo :
Returns :

equation_system_from_XML ()

equation_system *   equation_system_from_XML            (xmlNodePtr node,
                                                         xmlDocPtr doc,
                                                         const DATAINFO *pdinfo,
                                                         int *err);

node :
doc :
pdinfo :
err :
Returns :

system_save_and_print_results ()

int                 system_save_and_print_results       (equation_system *sys,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);

sys :
pZ :
pdinfo :
opt :
prn :
Returns :

system_autocorrelation_test ()

int                 system_autocorrelation_test         (equation_system *sys,
                                                         int order,
                                                         PRN *prn);

sys :
order :
prn :
Returns :

system_arch_test ()

int                 system_arch_test                    (equation_system *sys,
                                                         int order,
                                                         PRN *prn);

sys :
order :
prn :
Returns :

single_equation_liml ()

MODEL               single_equation_liml                (const int *list,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);

list :
pZ :
pdinfo :
opt :
Returns :