fintech-algorithms

Augmented Dickey-Fuller

Install and import

bash
npm install fintech-algorithms
ts
import { adf } from "fintech-algorithms/statistical-time-series/diagnostics/augmented-dickey-fuller";

Signature

adf(values, lags, criticalValue)

Worked example

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input

values
[0.49366418, 1.54242291, -0.82556495, 0.47513288, 0.50704417, -0.3816439]

Showing 6 of 96 elements.

lags
1
criticalValue
-2.86

Call

adf(values, lags, criticalValue)

Returns

object with 15 fields: method, variant, nobs, regression_nobs, lags, gamma, gamma_standard_error, statistic, …

{
  "method": "adf",
  "variant": "constant-only-fixed-lag",
  "nobs": 96,
  "regression_nobs": 94,
  "lags": 1,
  "gamma": -0.3307327402574888,
  "gamma_standard_error": 0.08555486242368153,
  "statistic": -3.8657386721007945,
  "critical_value": -2.86,
  "reject_null": true,
  "state": "reject-unit-root",
  "reason": "statistic-below-boundary",
  "coefficients": [0.09192051133561, -0.3307327402574888, -0.0052913498392460345],
  "residual_sse": 84.25503279621253
}

Showing 14 of 15 fields.

Other exports

This module also exports acf, pacf, kpss, ljungBox, zivotAndrews, runDiagnostic. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams

Augmented Dickey-Fuller — diagnostic anatomy

How it works

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References

  • statsmodels.tsa.stattools.adfuller
  • Distribution of the Estimators for Autoregressive Time Series with a Unit Root
  • Evidence decisions