fintech-algorithms

ACF

Install and import

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

Signature

acf(values, maxLag)

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.

maxLag
12

Call

acf(values, maxLag)

Returns

object with 11 fields: method, variant, nobs, max_lag, mean, denominator, numerators, coefficients, …

{
  "method": "acf",
  "variant": "centered-unadjusted-direct",
  "nobs": 96,
  "max_lag": 12,
  "mean": 0.29779557927083333,
  "denominator": 153.9714722414195,
  "numerators": [
    153.9714722414195,
    102.29629606088473,
    67.86612357881646,
    43.864068660314665,
    13.159013573869158,
    -12.01222465335103
  ],
  "coefficients": [
    1,
    0.6643847368068891,
    0.4407707648102877,
    0.28488438813871975,
    0.08546397187939134,
    -0.07801591085987973
  ],
  "confidence_95": 0.2000416623272929,
  "state": "estimated",
  "reason": "finite centered series with nonzero variance"
}

Other exports

This module also exports pacf, adf, 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

ACF — 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.acf
  • Evidence decisions