ADF, KPSS, Engle-Granger

ADF, KPSS, Engle-Granger — unit root and cointegration tests

Functions

int adf_test ()
int kpss_test ()
int levin_lin_test ()
int engle_granger_test ()
double get_urc_pvalue ()

Object Hierarchy


Includes

#include <libgretl.h>

Description

Implementations of the (Augmented) Dickey-Fuller test and the Kwiatkowski, Phillips, Schmidt and Shin test for the presence of a unit root in a time series, along with the Engle-Granger test for cointegration of two or more time series.

The Johansen cointegration test is also provided in libgretl; see johansen_test() and johansen_test_simple().

Functions

adf_test ()

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

Carries out and prints the results of the Augmented Dickey-Fuller test for a unit root.

By default two tests are performed, one for a model including a constant and one including a linear trend. The deterministic components of the model can be controlled via flags in opt as follows: OPT_N, omit the constant; OPT_C, run just one test using the constant; OPT_T, one test including linear trend; OPT_R, one test including a quadratic trend; OPT_D, include seasonal dummy variables.

Additional flags that may be given in opt include: OPT_V for verbose operation; OPT_F to apply first-differencing before testing; OPT_G for GLS preprocessing as in Elliott, Rothenberg and Stock (incompatible with OPT_N, OPT_R, OPT_D); OPT_E to "test down" from a given maximum lag order (see the entry for "adf" in the Gretl Command Reference for details).

Parameters

order

lag order for the (augmented) test.

 

list

list of variables to test.

 

dset

dataset struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, non-zero on error.


kpss_test ()

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

Carries out and prints the results of the KPSS test for stationarity. Flags that may be given in opt include: OPT_T to include a linear trend; OPT_F to apply first-differencing before testing; OPT_V for verbose operation.

Parameters

order

window size for Bartlett smoothing.

 

list

list of variables to test.

 

dset

dataset struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, non-zero on error.


levin_lin_test ()

int
levin_lin_test (int vnum,
                const int *plist,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Carries out and prints the results of the Levin-Lin-Chu test for a unit root in panel data.

The list plist should contain either a single lag order to be applied to all units, or a set of unit-specific orders; in the latter case the length of the list must equal the number of panel units in the current sample range. (This is a gretl list: the first element holds a count of the number of elements following.)

By default a test with constant is performed, but the (mutually exclusive) options OPT_N and OPT_T in opt switch to the case of no constant or constant plus trend respectively. The OPT_Q flag may be used to suppress printed output.

Parameters

vnum

ID number of variable to test.

 

plist

list of ADF lag orders.

 

dset

data information struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, non-zero on error.


engle_granger_test ()

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

Carries out the Engle-Granger test for cointegration. Flags that may be given in opt include: OPT_N, do not an include a constant in the cointegrating regression; OPT_T include constant and linear trend; OPT_R, include quadratic trend; OPT_S, skip DF tests for individual variables; OPT_E, test down from maximum lag order (see the entry for "adf" in the Gretl Command Reference for details); OPT_V, verbose operation.

Parameters

order

lag order for the test.

 

list

specifies the variables to use.

 

dset

dataset struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

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


get_urc_pvalue ()

double
get_urc_pvalue (double tau,
                int n,
                int niv,
                int itv,
                gretlopt opt);

Retrieves the p-value for tau from the Dickey–Fuller unit-root test or the Engle–Granger cointegration test, as per James MacKinnon (1996).

Parameters

tau

test statistic.

 

n

sample size (or 0 for asymptotic result).

 

niv

number of potentially cointegrated variables (1 for simple unit-root test).

 

itv

code: 1, 2, 3, 4 for nc, c, ct, ctt models respectively.

 

opt

give OPT_G if GLS adjustment was applied in the test from which tau was obtained.

 

Returns

p-value, or NADBL on failure.

Types and Values