fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Diagnostics

6 algorithms in Statistical Time Series.

In this family#

  1. ACF contract

    Autocorrelation at each lag. The first diagnostic to run on any series you intend to model: it shows whether there is structure to model at all, and slow decay is the classic signature of non-stationarity.

    acf(values, maxLag)
  2. PACF contract

    Partial autocorrelation: correlation at each lag with the intervening lags removed. Read together with the ACF it identifies model order — a PACF cutting off after lag p suggests AR(p).

    pacf(values, maxLag)
  3. Augmented Dickey-Fuller contract

    Tests for a unit root. The null is that the series *has* one — so failing to reject is not evidence of stationarity, merely absence of evidence against a unit root. That asymmetry is the most misread thing in applied time series.

    adf(values, lags, criticalValue)
  4. KPSS contract

    Tests stationarity with the null *reversed* relative to ADF: here the null is that the series is stationary. Running both is standard practice, because agreement is informative and disagreement tells you the sample cannot settle the question.

    kpss(values, lags, criticalValue)
  5. Ljung-Box contract

    Tests whether a group of autocorrelations is jointly zero. Applied to model residuals it answers the question that matters after fitting: is there structure left that the model failed to capture?

    ljungBox(values, lags, modelDf, alpha)
  6. Zivot-Andrews Break Test contract

    A unit-root test that allows one structural break at an unknown date, found by searching. Standard ADF frequently reports a unit root when the truth is a stationary series with a single level shift.

    zivotAndrews(values, lags, trim, criticalValue)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { acf } from "fintech-algorithms/statistical-time-series/diagnostics/acf";
import { pacf } from "fintech-algorithms/statistical-time-series/diagnostics/pacf";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Statistical Time Series collects 29 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.