DixonQTestDetector<T>

Models & Types · AiDotNet.AnomalyDetection.Statistical

Detects anomalies using Dixon’s Q Test for small datasets.

Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → DixonQTestDetector<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

Dixon’s Q Test is designed for detecting a single outlier in small datasets (typically n < 25). It compares the gap between the suspect value and its nearest neighbor to the range of the entire dataset.

How It Works

The test statistic is: Q = gap / range where gap = |suspect value - nearest value| and range = max - min.

When to use:

  • Small datasets (n < 25, ideally 3-10 samples)
  • You suspect exactly one outlier
  • Data is approximately normally distributed

Industry Standard Defaults:

  • Alpha (significance level): 0.05 (5%)

Reference: Dixon, W. J. (1950). “Analysis of Extreme Values.” Annals of Mathematical Statistics.

Constructors

Constructor Summary
DixonQTestDetector(double alpha, double contamination, int randomSeed) Creates a new Dixon’s Q Test anomaly detector.

Properties

Property Summary
double Alpha { get; } Gets the significance level (alpha) for the test.

Methods

Method Summary
Vector<T> Predict(Matrix<T> X)
Vector<T> ScoreAnomalies(Matrix<T> X)
double GetQCritical(int n) Gets the critical Q value for Dixon’s test based on sample size and alpha level.
void Fit(Matrix<T> X)