Table of Contents

Class CUSUMAlgorithm

Namespace
SignalSharp.Detection.CUSUM
Assembly
SignalSharp.dll

Implements the Cumulative Sum (CUSUM) algorithm for detecting change points in time series data.

public class CUSUMAlgorithm
Inheritance
CUSUMAlgorithm
Inherited Members

Remarks

The CUSUM (Cumulative Sum Control Chart) algorithm is a sequential analysis technique used primarily for monitoring change detection in time series data. It aims to identify points where the statistical properties of the data, such as the mean, change.

The algorithm maintains cumulative sums of the deviations of the signal values from the expected mean. It uses two sums: a high sum (for detecting positive changes) and a low sum (for detecting negative changes). When either sum exceeds a defined threshold, a change point is detected.

Constructors

CUSUMAlgorithm(CUSUMOptions?)

Initializes a new instance of the CUSUMAlgorithm class with optional configuration settings.

public CUSUMAlgorithm(CUSUMOptions? options = null)

Parameters

options CUSUMOptions

The configuration options for the CUSUM algorithm. If null, default options are used.

Methods

Detect(double[])

Detects change points in the time series using the CUSUM algorithm.

public int[] Detect(double[] signal)

Parameters

signal double[]

The one-dimensional time series data to fit.

Returns

int[]

An array of indices representing the change points.

Examples

var options = new CUSUMOptions
{
    ExpectedMean = 0,
    ExpectedStandardDeviation = 1,
    ThresholdFactor = 1.2,
    SlackFactor = 0.1
};
var cusum = new CUSUMAlgorithm(options);
double[] signal = { 0.2, 0.1, 0.2, 4.0, 0.1, 0.2, -2.0, 0.2, 0.1 };
int[] changePoints = cusum.Detect(signal);
// changePoints will contain the indices where changes are detected, e.g., [3, 6]

Exceptions

ArgumentNullException

Thrown when the signal data is null.