TimeSeriesSPCDetector
Detect subsequence anomalies in time series using statistical process control
Since R2026a
Description
Add-On Required: This feature requires the Time Series Anomaly Detection for MATLAB add-on.
TimeSeriesSPCDetector creates an anomaly detector based on
statistical process control (SPC) techniques.
SPC techniques track the values or statistics of a time series over time against mean and
standard deviation limits that bound normal data. The visual tracking mechanism is called a
control chart, which shows both the boundaries and a representative
statistic to track. The control rules determine when a violation
occurs. For example, the control rule "n1" reports a violation if the
statistic is three standard errors from the specified center line
Creating a TimeSeriesSPCDetector detector is the first step in a workflow
that includes training the detector with normal data, testing the detector with anomalous
data, and validating the model by visualizing detection effectiveness on anomalous data using
plotting functions. To improve detection performance, you can use updateDetector
to change certain properties, such as control limits, by updating the trained model without
retraining. To change other properties, you must create a new detector object and specify the
new properties using name-value arguments. You cannot modify detector properties using dot
notation.
For more detailed information on the statistical process control functions that this
detector is based on, see controlchart and controlrules in Statistics and Machine Learning Toolbox™.
Creation
Create a TimeSeriesSPCDetector object by using the timeSeriesSpcAD function.
Properties
Object Functions
train | Train statistical process control (SPC) anomaly detector and obtain detection threshold |
detect | Detect anomalies in time series using a trained time statistical process control (SPC) detector model |
plot | Plot detected anomalies and anomaly scores generated from time series anomaly detectors that are based on statistical process control |
plotHistogram | Plot histogram of anomaly scores and detection threshold for statistical process control (SPC) anomaly detector |
updateDetector | Update settings of a trained statistical process control anomaly detector |
References
[1] Nelson, Lloyd S. “The Shewhart Control Chart—Tests for Special Causes.” Journal of Quality Technology 16, no. 4 (1984): 237–39. https://doi.org/10.1080/00224065.1984.11978921.
[2] Alexopoulos, Christos, and Andrew F. Seila. “Implementing the Batch Means Method in Simulation Experiments.” Proceedings of the 28th Conference on Winter Simulation - WSC ’96, ACM Press, 1996, 214–21. https://doi.org/10.1145/256562.256608.
[3] Runger, George C., and Thomas R. Willemain. “Batch-Means Control Charts for Autocorrelated Data.” IIE Transactions 28, no. 6 (1996): 483–87. https://doi.org/10.1080/07408179608966295.
[4] Hunter, J. Stuart. “The Exponentially Weighted Moving Average.” Journal of Quality Technology 18, no. 4 (1986): 203–10. https://doi.org/10.1080/00224065.1986.11979014.
Version History
Introduced in R2026a