SKEWTEST

Overview

The SKEWTEST function tests whether the skewness of a sample differs significantly from that of a normal distribution. Skewness measures the asymmetry of a probability distribution—a normal distribution has zero skewness, while positively skewed distributions have a longer right tail and negatively skewed distributions have a longer left tail. This test helps determine if a dataset’s asymmetry is statistically significant enough to suggest non-normality.

This implementation uses the scipy.stats.skewtest function from SciPy, which is based on the methodology described by D’Agostino, Belanger, and D’Agostino Jr. in their 1990 paper “A suggestion for using powerful and informative tests of normality” published in the American Statistician. The test transforms the sample skewness into a z-score that follows approximately a standard normal distribution under the null hypothesis.

The algorithm computes the sample skewness coefficient \sqrt{b_1} and applies a transformation to produce a test statistic Z that is asymptotically normally distributed:

Z = \delta \cdot \sinh^{-1}\left(\frac{\sqrt{b_1}}{\alpha}\right)

where \alpha and \delta are constants derived from the sample size. The resulting z-score quantifies how many standard deviations the sample’s skewness deviates from the expected skewness of a normal distribution (zero).

The function returns both the test statistic and the two-sided p-value. A small p-value (typically < 0.05) indicates evidence that the sample comes from a distribution with non-zero skewness, suggesting departure from normality. The sample must contain at least 8 observations for the test to be valid, as the asymptotic approximation requires sufficient sample size for accuracy.

This test is particularly useful as a preliminary check for normality assumptions in parametric statistical procedures, or when specifically investigating whether data exhibits significant asymmetry. For a comprehensive normality assessment, consider combining this with the kurtosis test or using the normaltest which combines both.

For more details, see the SciPy skewness test tutorial and the SciPy GitHub repository.

This example function is provided as-is without any representation of accuracy.

Excel Usage

=SKEWTEST(data)
  • data (list[list], required): 2D array of numeric values to test for skewness. Must contain at least 8 elements.

Returns (list[list]): 2D list with test statistic and p-value, or error message (str) if invalid.

Examples

Example 1: Symmetric data sample

Inputs:

data
1
2
3
4
5
6
7
8

Excel formula:

=SKEWTEST({1;2;3;4;5;6;7;8})

Expected output:

Result
1.0108048609177787 0.3121098361421897

Example 2: Skewed data with outlier

Inputs:

data
1
2
3
4
5
6
7
8000

Excel formula:

=SKEWTEST({1;2;3;4;5;6;7;8000})

Expected output:

Result
3.571773510360407 0.0003545719905823133

Example 3: Nearly constant values

Inputs:

data
100
100
100
100
100
100
100
101

Excel formula:

=SKEWTEST({100;100;100;100;100;100;100;101})

Expected output:

Result
3.5717766638478072 0.000354567720281634

Example 4: Mixed unsorted values

Inputs:

data
2
8
0
4
1
9
9
0

Excel formula:

=SKEWTEST({2;8;0;4;1;9;9;0})

Expected output:

Result
0.44626385374196975 0.6554066631275459

Python Code

import math
from scipy.stats import skewtest as scipy_skewtest

def skewtest(data):
    """
    Test whether the skewness of a sample is different from that of a normal distribution.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.skewtest.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        data (list[list]): 2D array of numeric values to test for skewness. Must contain at least 8 elements.

    Returns:
        list[list]: 2D list with test statistic and p-value, or error message (str) if invalid.
    """
    def to2d(x):
        return [[x]] if not isinstance(x, list) else x

    data = to2d(data)

    if not isinstance(data, list) or not all(isinstance(row, list) for row in data):
        return "Invalid input: data must be a 2D list."

    flat = []
    for row in data:
        for x in row:
            try:
                flat.append(float(x))
            except (TypeError, ValueError):
                return "Invalid input: data must be numeric."

    if len(flat) < 8:
        return "Invalid input: data must contain at least 8 elements."

    try:
        result = scipy_skewtest(flat)
        stat = float(result.statistic)
        pval = float(result.pvalue)
        if math.isnan(stat) or math.isnan(pval) or math.isinf(stat) or math.isinf(pval):
            return "Invalid result: nan or inf encountered."
        return [[stat, pval]]
    except Exception as e:
        return f"scipy.stats.skewtest error: {e}"

Online Calculator