genmain

genmain

Synopsis

enum                RetrievalIndex;
enum                ModelDataIndex;
#define             model_data_scalar                   (i)
#define             model_data_series                   (i)
#define             model_data_matrix                   (i)
#define             model_data_matrix_builder           (i)
#define             model_data_list                     (i)
#define             model_data_string                   (i)
typedef             GENERATOR;
int                 generate                            (const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         PRN *prn);
GENERATOR *         genr_compile                        (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         int *err);
int                 execute_genr                        (GENERATOR *genr,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);
void                destroy_genr                        (GENERATOR *genr);
void                genr_set_loopline                   (GENERATOR *genr,
                                                         int i);
int                 genr_get_loopline                   (GENERATOR *genr);
int                 genr_get_output_type                (const GENERATOR *genr);
int                 genr_get_output_varnum              (const GENERATOR *genr);
double              genr_get_output_scalar              (const GENERATOR *genr);
int                 genr_get_last_output_type           (void);
gretl_matrix *      genr_get_output_matrix              (const GENERATOR *genr);
int                 series_index                        (const DATAINFO *pdinfo,
                                                         const char *varname);
int                 current_series_index                (const DATAINFO *pdinfo,
                                                         const char *vname);
int                 extract_varname                     (char *targ,
                                                         const char *src,
                                                         int *len);
int                 genr_fit_resid                      (const MODEL *pmod,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         ModelDataIndex idx);
double              generate_scalar                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);
double *            generate_series                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn,
                                                         int *err);
gretl_matrix *      generate_matrix                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);
char *              generate_string                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);
int *               generate_list                       (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);
int                 print_object_var                    (const char *oname,
                                                         const char *param,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);
int                 gretl_is_series                     (const char *name,
                                                         const DATAINFO *pdinfo);
int                 gretl_reserved_word                 (const char *str);
int                 genr_special_word                   (const char *s);
int                 genr_function_word                  (const char *s);
int                 genr_is_print                       (const GENERATOR *p);
int                 genr_is_autoregressive              (const GENERATOR *p);
void                genr_set_na_check                   (GENERATOR *genr);
void                genr_unset_na_check                 (GENERATOR *genr);
int                 genr_get_series_max                 (GENERATOR *genr);
int                 function_from_string                (const char *s);
int                 function_lookup                     (const char *s);
int                 const_lookup                        (const char *s);
double              get_const_by_name                   (const char *name);
const char *        gretl_function_complete             (const char *s);
void                gretl_function_hash_cleanup         (void);

Description

Details

enum RetrievalIndex

typedef enum {
    R_NOBS = 1,   /* number of observations in current sample range */
    R_NVARS,      /* number of variables in dataset (including the constant) */
    R_PD,         /* periodicity of dataset */
    R_T1,         /* start of current sample range */
    R_T2,         /* end of current sample range */
    R_DATATYPE,   /* dataset structure (x-section, time-series, panel) */
    R_WINDOWS,    /* running on MS Windows (1) or not (0) */
    R_VERSION,    /* gretl version number */
    R_ERRNO,      /* internal gretl error code */
    R_SEED,       /* RNG seed */
    R_DSET_MAX,   /* separator */
    R_TEST_LNL,   /* log-likelihood from last test (if applicable) */
    R_KLNL,       /* log-likelihood from Kalman filter (if applicable) */
    R_KS2,        /* variance estimate from Kalman filter (if applicable) */
    R_KSTEP,      /* current Kalman time-step (if applicable) */
    R_STOPWATCH,  /* stopwatch */ 
    R_NSCAN,      /* number of items scanned via sscanf */
    R_SCALAR_MAX, /* separator: scalars vs series */
    R_INDEX,      /* consecutive observations index */
    R_PUNIT,      /* 1-based panel unit index */
    R_SERIES_MAX, /* separator: series vs matrices */
    R_TEST_STAT,  /* last test statistic(s) (scalar or matrix) */
    R_TEST_PVAL,  /* last test p-value(s) (scalar or matrix) */
    R_MAX
} RetrievalIndex;


enum ModelDataIndex

typedef enum {
    M_ESS = R_MAX + 1, /* error sum of squares */
    M_T,          /* observations used */
    M_RSQ,        /* R-squared */
    M_SIGMA,      /* standard error of residuals */
    M_DF,         /* degrees of freedom */
    M_NCOEFF,     /* total number of estimated coefficients */
    M_LNL,        /* log-likelihood */
    M_GMMCRIT,    /* GMM criterion */
    M_AIC,        /* Akaike info criterion */
    M_BIC,        /* Bayesian info criterion */
    M_HQC,        /* Hannan-Quinn criterion */
    M_TRSQ,       /* T * R-squared, last model */
    M_DWPVAL,     /* Durbin-Watson p-value, last model */
    M_FSTT,       /* overall F-statistic, last model */
    M_CHISQ,      /* overall chi-square stat, last model */   
    M_SCALAR_MAX, /* -- SEPARATOR, scalars/series -- */
    M_UHAT,       /* residuals */
    M_YHAT,       /* fitted values */
    M_LLT,        /* per-observation loglikelihood */
    M_AHAT,       /* per-unit intercepts in panel model */
    M_H,          /* GARCH predicted variances */
    M_SAMPLE,     /* observations used in estimation */
    M_UHAT2,      /* squared residuals */
    M_SERIES_MAX, /* -- SEPARATOR, series/matrices -- */
    M_COEFF,      /* parameter estimates */
    M_SE,         /* parameter standard errors */
    M_VCV,        /* parameter covariance matrix */
    M_RHO,        /* autoregressive coefficients */
    M_COMPAN,     /* VAR companion matrix */
    M_XTXINV,     /* VARs, VECMs: X'X^{-1} */
    M_VECG,       /* VECMs: the Gamma matrices */
    M_EVALS,      /* VECMs: eigenvalues */
    M_JALPHA,     /* Johansen's alpha */
    M_JBETA,      /* Johansen's beta */
    M_JVBETA,     /* Covariance matrix for Johansen's normalized beta */
    M_JS00,       /* VECM residual covariance matrix (1st differences) */
    M_JS11,       /* VECM residual covariance matrix (levels) */
    M_JS01,       /* VECM residual cross-product matrix */
    M_HAUSMAN,    /* Hausman test after tsls or fixed effects */
    M_SARGAN,     /* Sargan over-identification test after tsls */
    M_SYSGAM,     /* Parameter matrix Gamma (simultaneous systems) */
    M_SYSA,       /* Parameter matrix A (simultaneous systems) */
    M_SYSB,       /* Parameter matrix B (simultaneous systems) */
    M_FCAST,      /* last forecast generated via fcast command */
    M_FCERR,      /* standard errors associated with M_FCAST */
    M_COEFF_CI,   /* (asymmetric) confidence intervals for coeffs */
    M_KLLT,       /* Kalman log-likelihood, per time-step */
    M_KUHAT,      /* Kalman: current prediction error */
    M_EHAT,       /* ARMA: vector of estimated innovations */
    M_MATRIX_MAX, /* -- SEPARATOR, end of matrices -- */
    M_EC,         /* VECM error-correction terms */
    M_VMA,        /* VARs, VECMs: vector moving average representation */
    M_FEVD,       /* VAR variance decomposition */
    M_MNLPROBS,   /* case probabilities for multinomial logit */
    M_MBUILD_MAX, /* -- SEPARATOR, end of matrix-builders -- */
    M_XLIST,      /* list of regressors */
    M_LIST_MAX,   /* -- SEPARATOR, end of lists -- */
    M_COMMAND,    /* model command word */
    M_DEPVAR,     /* name of dependent variable */
    M_MAX         /* sentinel */
} ModelDataIndex;

Symbolic names for various scalars, series and matrices that can be retrieved from gretl models.


model_data_scalar()

#define model_data_scalar(i) (i > R_MAX && i < M_SCALAR_MAX)


model_data_series()

#define model_data_series(i) (i > M_SCALAR_MAX && i < M_SERIES_MAX)


model_data_matrix()

#define model_data_matrix(i) (i > M_SERIES_MAX && i < M_MATRIX_MAX)


model_data_matrix_builder()

#define             model_data_matrix_builder(i)


model_data_list()

#define model_data_list(i)   (i > M_MBUILD_MAX && i < M_LIST_MAX)


model_data_string()

#define model_data_string(i) (i > M_LIST_MAX && i < M_MAX)


GENERATOR

typedef struct parser_ GENERATOR;


generate ()

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


genr_compile ()

GENERATOR *         genr_compile                        (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt,
                                                         int *err);


execute_genr ()

int                 execute_genr                        (GENERATOR *genr,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);


destroy_genr ()

void                destroy_genr                        (GENERATOR *genr);


genr_set_loopline ()

void                genr_set_loopline                   (GENERATOR *genr,
                                                         int i);


genr_get_loopline ()

int                 genr_get_loopline                   (GENERATOR *genr);


genr_get_output_type ()

int                 genr_get_output_type                (const GENERATOR *genr);


genr_get_output_varnum ()

int                 genr_get_output_varnum              (const GENERATOR *genr);


genr_get_output_scalar ()

double              genr_get_output_scalar              (const GENERATOR *genr);


genr_get_last_output_type ()

int                 genr_get_last_output_type           (void);


genr_get_output_matrix ()

gretl_matrix *      genr_get_output_matrix              (const GENERATOR *genr);


series_index ()

int                 series_index                        (const DATAINFO *pdinfo,
                                                         const char *varname);

pdinfo :

data information struct.

varname :

name of variable to test.

Returns :

the ID number of the variable whose name is given, or the next available ID number if there is no variable of that name.

current_series_index ()

int                 current_series_index                (const DATAINFO *pdinfo,
                                                         const char *vname);


extract_varname ()

int                 extract_varname                     (char *targ,
                                                         const char *src,
                                                         int *len);

Writes up to VNAMELEN - 1 characters from s into vname.

targ :

target string into which to write name.

src :

source string.

len :

location to receive the length of the extracted portion.

Returns :

0 on success, non-zero if the number of valid varname characters in s is greater than VNAMELEN - 1.

genr_fit_resid ()

int                 genr_fit_resid                      (const MODEL *pmod,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         ModelDataIndex idx);

Adds residuals or fitted values or squared residuals from a given model to the data set.

pmod :

pointer to source model.

pZ :

pointer to data array.

pdinfo :

information on the data set.

idx :

M_UHAT, M_UHAT2, M_YHAT, M_AHAT or M_H.

Returns :

0 on successful completion, error code on error.

generate_scalar ()

double              generate_scalar                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);


generate_series ()

double *            generate_series                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn,
                                                         int *err);


generate_matrix ()

gretl_matrix *      generate_matrix                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);


generate_string ()

char *              generate_string                     (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);


generate_list ()

int *               generate_list                       (const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *err);


print_object_var ()

int                 print_object_var                    (const char *oname,
                                                         const char *param,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);


gretl_is_series ()

int                 gretl_is_series                     (const char *name,
                                                         const DATAINFO *pdinfo);


gretl_reserved_word ()

int                 gretl_reserved_word                 (const char *str);

str :

string to be tested.

Returns :

non-zero if str is a reserved word that cannot figure as the name of a user-defined variable, otherwise 0.

genr_special_word ()

int                 genr_special_word                   (const char *s);


genr_function_word ()

int                 genr_function_word                  (const char *s);


genr_is_print ()

int                 genr_is_print                       (const GENERATOR *p);


genr_is_autoregressive ()

int                 genr_is_autoregressive              (const GENERATOR *p);


genr_set_na_check ()

void                genr_set_na_check                   (GENERATOR *genr);


genr_unset_na_check ()

void                genr_unset_na_check                 (GENERATOR *genr);


genr_get_series_max ()

int                 genr_get_series_max                 (GENERATOR *genr);


function_from_string ()

int                 function_from_string                (const char *s);

s :

the string to look up.

Returns :

1 if there is a function corresponding to the name s, or 0 if there is no such function.

function_lookup ()

int                 function_lookup                     (const char *s);


const_lookup ()

int                 const_lookup                        (const char *s);


get_const_by_name ()

double              get_const_by_name                   (const char *name);


gretl_function_complete ()

const char *        gretl_function_complete             (const char *s);


gretl_function_hash_cleanup ()

void                gretl_function_hash_cleanup         (void);