iode.dickey_fuller_test

iode.dickey_fuller_test(lec: str, drift: bool, trend: bool, order: int) Scalars[source]

Dickey-Fuller tests.

Tests are saved in scalars whose name is composed of the prefix df_ and the name of the first series appearing in the formula to be tested. For example, the test for the formula \(d(A0GR+A0GF)\) is df_a0gr.

Parameters:
lec: str

LEC form to be tested.

drift: bool

Whether or not the formula to be estimated must incorporate a constant term.

trend: bool

Whether or not the formula to be estimated should incorporate a trend term.

order: int

Order of the polynomial to be estimated to obtain the tests.

Returns:
Scalars

Scalars database containing the results of the Dickey-Fuller tests.

Examples

>>> from iode import SAMPLE_DATA_DIR, scalars, variables
>>> from iode import dickey_fuller_test
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded
>>> # dickey_fuller_test("ACAF", True, True, 3) estimates the equation:
>>> #     d(ACAF) := df_ * ACAF[-1] +            
>>> #     df_d +            (DRIFT)          
>>> #     df_t * t +        (TREND)            
>>> #     df1 * d(ACAF[-1]) + df2*d(ACAF[-2]) + df3*d(ACAF[-3])  (ORDER)
>>> df_scalars = dickey_fuller_test("ACAF", True, True, 3)
Estimating : iteration 1 (||eps|| = 2.20454)
Estimating : iteration 2 (||eps|| = 2.39047e-10)
Solution reached after 2 iteration(s). Creating results file ...
>>> df_scalars.get_names("df*")
['df1', 'df2', 'df3', 'df_', 'df_d', 'df_t']
>>> # note: the function dickey_fuller_test() returns a separated Scalars database.
>>> #       The global database scalars is left unchaged
>>> scalars.get_names("df*")
[]
>>> # order 0
>>> df_scalars["df_"]
Scalar(0.0132523, 0.0845155, 0.0845155)
>>> # drift
>>> df_scalars["df_d"]
Scalar(13.0806, 1, 6.78675)
>>> # trend
>>> df_scalars["df_t"]
Scalar(-0.492697, 0.187978, 0.187978)
>>> # order 1
>>> df_scalars["df1"]
Scalar(-0.120123, 0.180991, 0.180991)
>>> # order 2
>>> df_scalars["df2"]
Scalar(-0.476959, 0.154505, 0.154505)
>>> # order 3
>>> df_scalars["df3"]
Scalar(-0.211047, 0.170708, 0.170708)