var

var

Synopsis

typedef             JohansenInfo;
#define             var_n_lags                          (v)
#define             var_max_lag                         (v)
int                 var_max_order                       (const int *list,
                                                         const DATASET *dset);
GRETL_VAR *         gretl_VAR                           (int order,
                                                         int *laglist,
                                                         int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);
GRETL_VAR *         gretl_VECM                          (int order,
                                                         int rank,
                                                         int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);
const gretl_matrix * gretl_VAR_get_forecast_matrix      (GRETL_VAR *var,
                                                         int t1,
                                                         int t2,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         int *err);
const gretl_matrix * gretl_VAR_get_residual_matrix      (const GRETL_VAR *var);
gretl_matrix *      gretl_VAR_get_fcast_decomp          (const GRETL_VAR *var,
                                                         int targ,
                                                         int periods,
                                                         int *errp);
gretl_matrix *      gretl_VAR_get_vma_matrix            (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int *err);
gretl_matrix *      gretl_VAR_get_FEVD_matrix           (const GRETL_VAR *var,
                                                         int targ,
                                                         int horizon,
                                                         const DATASET *dset,
                                                         int *err);
gretl_matrix *      gretl_VAR_get_full_FEVD_matrix      (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int *err);
gretl_matrix *      VECM_get_EC_matrix                  (const GRETL_VAR *v,
                                                         const DATASET *dset,
                                                         int *err);
int                 gretl_VAR_do_error_decomp           (const gretl_matrix *S,
                                                         gretl_matrix *C,
                                                         const gretl_matrix *ord);
const gretl_matrix * gretl_VAR_get_roots                (GRETL_VAR *var,
                                                         int *err);
int                 gretl_VAR_autocorrelation_test      (GRETL_VAR *var,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 gretl_VAR_arch_test                 (GRETL_VAR *var,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 gretl_VAR_normality_test            (const GRETL_VAR *var,
                                                         PRN *prn);
int                 set_VAR_model_stats                 (GRETL_VAR *var,
                                                         int i);
const int *         gretl_VAR_get_exo_list              (const GRETL_VAR *var);
const int *         gretl_VAR_get_endo_list             (const GRETL_VAR *var);
GRETL_VAR *         gretl_VAR_omit_test                 (GRETL_VAR *var,
                                                         const int *omitlist,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);
int                 gretl_VAR_wald_omit_test            (GRETL_VAR *var,
                                                         const int *omitlist,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
double *            gretl_VECM_get_EC                   (GRETL_VAR *vecm,
                                                         int j,
                                                         const DATASET *dset,
                                                         int *err);
void                gretl_VAR_free                      (GRETL_VAR *var);
int                 default_VAR_horizon                 (const DATASET *dset);
gretl_matrix *      gretl_VAR_get_impulse_response      (GRETL_VAR *var,
                                                         int targ,
                                                         int shock,
                                                         int periods,
                                                         double alpha,
                                                         const DATASET *dset,
                                                         int *err);
void                gretl_VAR_set_name                  (GRETL_VAR *var,
                                                         const char *name);
const char *        gretl_VAR_get_name                  (const GRETL_VAR *var);
int                 gretl_VAR_get_variable_number       (const GRETL_VAR *var,
                                                         int k);
int                 gretl_VAR_get_n_equations           (const GRETL_VAR *var);
int                 gretl_VAR_get_t1                    (const GRETL_VAR *var);
int                 gretl_VAR_get_t2                    (const GRETL_VAR *var);
int                 gretl_var_get_sample                (const GRETL_VAR *var,
                                                         int *t1,
                                                         int *t2);
const MODEL *       gretl_VAR_get_model                 (const GRETL_VAR *var,
                                                         int i);
double *            gretl_VAR_get_resid_series          (GRETL_VAR *var,
                                                         int eqnum,
                                                         int *err);
int                 gretl_VAR_set_ordering              (GRETL_VAR *var,
                                                         gretl_matrix *ord);
int                 gretl_VAR_do_irf                    (GRETL_VAR *var,
                                                         const char *line,
                                                         const DATASET *dset);
int                 gretl_VAR_get_highest_variable      (const GRETL_VAR *var);
GRETL_VAR *         johansen_test                       (int order,
                                                         const int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 johansen_test_simple                (int order,
                                                         const int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 gretl_VECM_n_beta                   (const GRETL_VAR *vecm);
int                 gretl_VECM_n_alpha                  (const GRETL_VAR *vecm);
int                 gretl_VECM_test                     (GRETL_VAR *vecm,
                                                         gretl_restriction *rset,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
GRETL_VAR *         real_gretl_restricted_vecm          (GRETL_VAR *orig,
                                                         gretl_restriction *rset,
                                                         const DATASET *dset,
                                                         PRN *prn,
                                                         int *err);
int                 gretl_VECM_rank                     (const GRETL_VAR *vecm);
int                 beta_restricted_VECM                (const GRETL_VAR *vecm);
int                 alpha_restricted_VECM               (const GRETL_VAR *vecm);
int                 restricted_VECM                     (const GRETL_VAR *vecm);
const gretl_matrix * gretl_VECM_R_matrix                (const GRETL_VAR *vecm);
const gretl_matrix * gretl_VECM_q_matrix                (const GRETL_VAR *vecm);
const gretl_matrix * gretl_VECM_Ra_matrix               (const GRETL_VAR *vecm);
const gretl_matrix * gretl_VECM_qa_matrix               (const GRETL_VAR *vecm);
double *            gretl_VAR_get_series                (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int idx,
                                                         const char *key,
                                                         int *err);
gretl_matrix *      gretl_VAR_get_matrix                (const GRETL_VAR *var,
                                                         int idx,
                                                         int *err);
void                gretl_VAR_param_names               (GRETL_VAR *v,
                                                         char **params,
                                                         const DATASET *dset);
int                 gretl_VAR_serialize                 (const GRETL_VAR *var,
                                                         SavedObjectFlags flags,
                                                         FILE *fp);
int                 transcribe_VAR_models               (GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         const gretl_matrix *XTX);
GRETL_VAR *         gretl_VAR_from_XML                  (xmlNodePtr node,
                                                         xmlDocPtr doc,
                                                         const DATASET *dset,
                                                         int *err);

Description

Details

JohansenInfo

typedef struct JohansenInfo_ JohansenInfo;


var_n_lags()

#define var_n_lags(v) ((v->lags != NULL)? v->lags[0] : v->order)


var_max_lag()

#define var_max_lag(v) ((v->lags != NULL)? v->lags[v->lags[0]] : v->order)


var_max_order ()

int                 var_max_order                       (const int *list,
                                                         const DATASET *dset);


gretl_VAR ()

GRETL_VAR *         gretl_VAR                           (int order,
                                                         int *laglist,
                                                         int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);

Estimate a vector auto-regression (VAR), print and save the results.

order :

lag order for the VAR.

laglist :

specific list of lags, or NULL.

list :

specification for the first model in the set.

dset :

dataset struct.

opt :

if includes OPT_R, use robust VCV; if includes OPT_H, use HAC VCV; if includes OPT_I, print impulse responses; if includes OPT_F, print forecast variance decompositions; if includes OPT_D, add seasonal dummies; if includes OPT_N, do not include a constant. if includes OPT_Q, do not show individual regressions. if includes OPT_T, include a linear trend. if includes OPT_L, test for optimal lag length (only). if includes OPT_S, silent (no printing).

prn :

gretl printing struct.

err :

location to receive error code.

Returns :

pointer to VAR struct, which may be NULL on error.

gretl_VECM ()

GRETL_VAR *         gretl_VECM                          (int order,
                                                         int rank,
                                                         int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);

order :

lag order.

rank :

cointegration rank.

list :

list of endogenous variables, possibly plus exogenous variables.

dset :

dataset struct.

opt :

may include OPT_N ("nc"), OPT_R ("rc"), OPT_A ("crt"), OPT_T ("ct"), OPT_D (include seasonals), OPT_F (show variance decompositions), OPT_I (show impulse responses), OPT_V (verbose operation), OPT_Q (quiet), OPT_S (silent).

prn :

gretl printing struct.

err :

location to receive error code.

Returns :

pointer to struct containing a VECM system, or NULL on failure.

gretl_VAR_get_forecast_matrix ()

const gretl_matrix * gretl_VAR_get_forecast_matrix      (GRETL_VAR *var,
                                                         int t1,
                                                         int t2,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         int *err);


gretl_VAR_get_residual_matrix ()

const gretl_matrix * gretl_VAR_get_residual_matrix      (const GRETL_VAR *var);


gretl_VAR_get_fcast_decomp ()

gretl_matrix *      gretl_VAR_get_fcast_decomp          (const GRETL_VAR *var,
                                                         int targ,
                                                         int periods,
                                                         int *errp);


gretl_VAR_get_vma_matrix ()

gretl_matrix *      gretl_VAR_get_vma_matrix            (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int *err);


gretl_VAR_get_FEVD_matrix ()

gretl_matrix *      gretl_VAR_get_FEVD_matrix           (const GRETL_VAR *var,
                                                         int targ,
                                                         int horizon,
                                                         const DATASET *dset,
                                                         int *err);


gretl_VAR_get_full_FEVD_matrix ()

gretl_matrix *      gretl_VAR_get_full_FEVD_matrix      (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int *err);


VECM_get_EC_matrix ()

gretl_matrix *      VECM_get_EC_matrix                  (const GRETL_VAR *v,
                                                         const DATASET *dset,
                                                         int *err);


gretl_VAR_do_error_decomp ()

int                 gretl_VAR_do_error_decomp           (const gretl_matrix *S,
                                                         gretl_matrix *C,
                                                         const gretl_matrix *ord);


gretl_VAR_get_roots ()

const gretl_matrix * gretl_VAR_get_roots                (GRETL_VAR *var,
                                                         int *err);


gretl_VAR_autocorrelation_test ()

int                 gretl_VAR_autocorrelation_test      (GRETL_VAR *var,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);


gretl_VAR_arch_test ()

int                 gretl_VAR_arch_test                 (GRETL_VAR *var,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);


gretl_VAR_normality_test ()

int                 gretl_VAR_normality_test            (const GRETL_VAR *var,
                                                         PRN *prn);


set_VAR_model_stats ()

int                 set_VAR_model_stats                 (GRETL_VAR *var,
                                                         int i);


gretl_VAR_get_exo_list ()

const int *         gretl_VAR_get_exo_list              (const GRETL_VAR *var);


gretl_VAR_get_endo_list ()

const int *         gretl_VAR_get_endo_list             (const GRETL_VAR *var);


gretl_VAR_omit_test ()

GRETL_VAR *         gretl_VAR_omit_test                 (GRETL_VAR *var,
                                                         const int *omitlist,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn,
                                                         int *err);

Re-estimates a given VAR after removing the variables specified in omitlist, and reports per-equation F-tests and system-wide LR tests for the null hypothesis that the omitted variables have zero parameters.

var :

pointer to original VAR.

omitlist :

list of variables to omit from original model.

dset :

dataset struct.

opt :

option flags.

prn :

gretl printing struct.

err :

location to receive error code.

Returns :

restricted VAR on success, NULL on error.

gretl_VAR_wald_omit_test ()

int                 gretl_VAR_wald_omit_test            (GRETL_VAR *var,
                                                         const int *omitlist,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);

Runs a Wald test for the joint omission of the exogenous variables specified in omitlist.

var :

pointer to original.

omitlist :

list of variables to omit from original model.

dset :

dataset struct.

opt :

option flags.

prn :

gretl printing struct.

Returns :

0 on successful completion, non-zero error code otherwise.

gretl_VECM_get_EC ()

double *            gretl_VECM_get_EC                   (GRETL_VAR *vecm,
                                                         int j,
                                                         const DATASET *dset,
                                                         int *err);


gretl_VAR_free ()

void                gretl_VAR_free                      (GRETL_VAR *var);


default_VAR_horizon ()

int                 default_VAR_horizon                 (const DATASET *dset);


gretl_VAR_get_impulse_response ()

gretl_matrix *      gretl_VAR_get_impulse_response      (GRETL_VAR *var,
                                                         int targ,
                                                         int shock,
                                                         int periods,
                                                         double alpha,
                                                         const DATASET *dset,
                                                         int *err);

Computes the response of targ to a perturbation of shock in the context of var: targ and shock are zero-based indices relative to the structure of var. For example if targ = 0 and shock = 1, we compute the response of the dependent variable in the first VAR equation to a perturbation of the variable that appears as dependent in the second VAR equation.

If alpha is zero, the response matrix returned is a column vector of length periods, giving the point estimate of the response function. Otherwise, the response matrix returned has three columns, containing the point estimate, the alpha / 2 quantile and the 1 - alpha / 2 quantile, where the quantiles are based on 999 bootstrap replications, with resampling of the original residuals with replacement.

var :

pointer to VAR struct.

targ :

index of the target or response variable.

shock :

index of the source or shock variable.

periods :

number of periods over which to compute the response.

alpha :

determines confidence level for bootstrap interval.

dset :

dataset struct.

err :

location to receive error code.

Returns :

matrix containing the estimated impulse responses, with or without a confidence interval.

gretl_VAR_set_name ()

void                gretl_VAR_set_name                  (GRETL_VAR *var,
                                                         const char *name);


gretl_VAR_get_name ()

const char *        gretl_VAR_get_name                  (const GRETL_VAR *var);


gretl_VAR_get_variable_number ()

int                 gretl_VAR_get_variable_number       (const GRETL_VAR *var,
                                                         int k);


gretl_VAR_get_n_equations ()

int                 gretl_VAR_get_n_equations           (const GRETL_VAR *var);


gretl_VAR_get_t1 ()

int                 gretl_VAR_get_t1                    (const GRETL_VAR *var);


gretl_VAR_get_t2 ()

int                 gretl_VAR_get_t2                    (const GRETL_VAR *var);


gretl_var_get_sample ()

int                 gretl_var_get_sample                (const GRETL_VAR *var,
                                                         int *t1,
                                                         int *t2);


gretl_VAR_get_model ()

const MODEL *       gretl_VAR_get_model                 (const GRETL_VAR *var,
                                                         int i);


gretl_VAR_get_resid_series ()

double *            gretl_VAR_get_resid_series          (GRETL_VAR *var,
                                                         int eqnum,
                                                         int *err);


gretl_VAR_set_ordering ()

int                 gretl_VAR_set_ordering              (GRETL_VAR *var,
                                                         gretl_matrix *ord);


gretl_VAR_do_irf ()

int                 gretl_VAR_do_irf                    (GRETL_VAR *var,
                                                         const char *line,
                                                         const DATASET *dset);


gretl_VAR_get_highest_variable ()

int                 gretl_VAR_get_highest_variable      (const GRETL_VAR *var);


johansen_test ()

GRETL_VAR *         johansen_test                       (int order,
                                                         const int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);

Carries out the Johansen test for cointegration.

order :

lag order for test.

list :

list of variables to test for cointegration.

dset :

dataset struct.

opt :

OPT_A: include constant plus restricted trend; OPT_D: include centered seasonals; OPT_N: no constant; OPT_R: restricted constant; OPT_T: constant and unrestricted trend (note: default "case" is unrestricted constant). OPT_V: produce verbose results.

prn :

gretl printing struct.

Returns :

pointer to struct containing information on the test.

johansen_test_simple ()

int                 johansen_test_simple                (int order,
                                                         const int *list,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);

Carries out the Johansen test for cointegration and prints the results (but unlike johansen_test(), does not return the allocated results in VAR form).

order :

lag order for test.

list :

list of variables to test for cointegration.

dset :

dataset struct.

opt :

OPT_A: include constant plus restricted trend; OPT_D: include centered seasonals; OPT_N: no constant; OPT_R: restricted constant; OPT_T: constant and unrestricted trend (note: default "case" is unrestricted constant); OPT_V: produce verbose results; OPT_Q: just print the tests; OPT_S: don't print anything.

prn :

gretl printing struct.

Returns :

0 on success, non-zero code on error.

gretl_VECM_n_beta ()

int                 gretl_VECM_n_beta                   (const GRETL_VAR *vecm);


gretl_VECM_n_alpha ()

int                 gretl_VECM_n_alpha                  (const GRETL_VAR *vecm);


gretl_VECM_test ()

int                 gretl_VECM_test                     (GRETL_VAR *vecm,
                                                         gretl_restriction *rset,
                                                         const DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);


real_gretl_restricted_vecm ()

GRETL_VAR *         real_gretl_restricted_vecm          (GRETL_VAR *orig,
                                                         gretl_restriction *rset,
                                                         const DATASET *dset,
                                                         PRN *prn,
                                                         int *err);

orig :

orginal VECM model.

rset :

restriction information.

dset :

dataset struct.

prn :

gretl printing struct.

err :

location to receive error code.

Returns :

pointer to struct containing information on the newly restricted VECM system or NULL on failure.

gretl_VECM_rank ()

int                 gretl_VECM_rank                     (const GRETL_VAR *vecm);


beta_restricted_VECM ()

int                 beta_restricted_VECM                (const GRETL_VAR *vecm);


alpha_restricted_VECM ()

int                 alpha_restricted_VECM               (const GRETL_VAR *vecm);


restricted_VECM ()

int                 restricted_VECM                     (const GRETL_VAR *vecm);


gretl_VECM_R_matrix ()

const gretl_matrix * gretl_VECM_R_matrix                (const GRETL_VAR *vecm);


gretl_VECM_q_matrix ()

const gretl_matrix * gretl_VECM_q_matrix                (const GRETL_VAR *vecm);


gretl_VECM_Ra_matrix ()

const gretl_matrix * gretl_VECM_Ra_matrix               (const GRETL_VAR *vecm);


gretl_VECM_qa_matrix ()

const gretl_matrix * gretl_VECM_qa_matrix               (const GRETL_VAR *vecm);


gretl_VAR_get_series ()

double *            gretl_VAR_get_series                (const GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         int idx,
                                                         const char *key,
                                                         int *err);


gretl_VAR_get_matrix ()

gretl_matrix *      gretl_VAR_get_matrix                (const GRETL_VAR *var,
                                                         int idx,
                                                         int *err);


gretl_VAR_param_names ()

void                gretl_VAR_param_names               (GRETL_VAR *v,
                                                         char **params,
                                                         const DATASET *dset);


gretl_VAR_serialize ()

int                 gretl_VAR_serialize                 (const GRETL_VAR *var,
                                                         SavedObjectFlags flags,
                                                         FILE *fp);


transcribe_VAR_models ()

int                 transcribe_VAR_models               (GRETL_VAR *var,
                                                         const DATASET *dset,
                                                         const gretl_matrix *XTX);


gretl_VAR_from_XML ()

GRETL_VAR *         gretl_VAR_from_XML                  (xmlNodePtr node,
                                                         xmlDocPtr doc,
                                                         const DATASET *dset,
                                                         int *err);