---
title: Statistical Functions
slug: litmusedge/statistical-functions
docTags: 
createdAt: 2024-08-06T18:57:43.939Z
---

The Statistical Functions processor tests how closely a window of data matches a normal distribution, using the goodness-of-fit tests you enable, and returns a p-value for each indicating the strength of that match.

## Why use Statistical Functions

Use this processor to check whether your data behaves like a normal distribution before applying downstream statistics that assume normality, for example, before running control charts or capability calculations that rely on that assumption.

## How it works

Enable one or more of five goodness-of-fit tests via their checkboxes. Each observes a window of data and returns a p-value: the smaller the p-value, the less likely the data came from a normal distribution.

- **Jarque-Bera** compares the window's skewness and kurtosis to what a normal distribution would produce, calculated as `JB = (n/6)(skewness² + (1/4)(kurtosis - 3)²)`. The further the result is from zero, the less the data resembles a normal distribution.
- **Cramer-von Mises** calculates the window's mean, standard deviation, and Z-scores, then compares the summed squared differences between the data's distribution and the expected normal distribution: `cramerVonMises = (1/12n) + Σ((2i-1)/(2n) - Φ(Z))²`.
- **Anderson-Darling** uses the same mean, standard deviation, and Z-score calculations as Cramer-von Mises, but weights the tails of the distribution more heavily.
- **D'Agostino-Pearson** combines a skewness test and a kurtosis test to check whether the window's shape matches a normal distribution.
- **Kolmogorov-Smirnov** (using the Lilliefors variant for testing normality) calculates the window's mean, standard deviation, and Z-scores, then finds `D+` and `D-`, the largest gaps between the data's distribution and the expected cumulative distribution. The test statistic is `max(D+, D-) × √n`.

## Parameters

| **Parameter**      | **Details**                                                         |
| ------------------ | ------------------------------------------------------------------- |
| Window Size        | The window of data used for each enabled test.                      |
| Jarque-Bera        | Enables the Jarque-Bera test.                                       |
| Anderson-Darling   | Enables the Anderson-Darling test.                                  |
| Cramer-von Mises   | Enables the Cramer-von Mises test.                                  |
| D'Agostino-Pearson | Enables the D'Agostino-Pearson test.                                |
| Kolmogorov-Smirnov | Enables the Kolmogorov-Smirnov test (using the Lilliefors variant). |

## Related topics

- [Use the Statistical Tests Function](docId\:uw5z1eF2ZE3nndx2idxIO)&#x20;

