| Top |
| int | adf_test () |
| int | kpss_test () |
| int | levin_lin_test () |
| int | engle_granger_test () |
| double | get_urc_pvalue () |
| gretl_matrix * | kpss_critvals () |
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().
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).
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.
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.
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.
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).
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 |