Skip to Content

SKEWTEST

Overview

The SKEWTEST function tests whether the skewness of a sample is different from that of a normal distribution. This is useful for assessing the symmetry of a dataset and determining if it deviates from normality. The test computes a z-score for the skewness and a corresponding p-value, based on the D’Agostino test:

z=n(n1)n2m3m23/2z = \frac{\sqrt{n(n-1)}}{n-2} \cdot \frac{m_3}{m_2^{3/2}}

where m3m_3 is the third central moment and m2m_2 is the second central moment (variance). For more details, see the scipy.stats.skewtest documentation.

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

Usage

To use the function in Excel:

=SKEWTEST(data)
  • data (2D list, required): Sample data. Must contain at least 8 elements (as a column or row vector).

The function returns a 2D list with two values: the test statistic (z-score) and the p-value. If the input is invalid, an error message is returned as a string.

Examples

Example 1: Symmetric Data

Inputs:

data
1
2
3
4
5
6
7
8

Excel formula:

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

Expected output:

StatisticP-value
1.0108050.312110

Example 2: Skewed Data

Inputs:

data
1
2
3
4
5
6
7
8000

Excel formula:

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

Expected output:

StatisticP-value
3.5717740.000355

Example 3: Repeated Values

Inputs:

data
100
100
100
100
100
100
100
101

Excel formula:

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

Expected output:

StatisticP-value
3.5717770.000355

Example 4: Mixed Data

Inputs:

data
2
8
0
4
1
9
9
0

Excel formula:

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

Expected output:

StatisticP-value
0.4462640.655407

Python Code

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. Args: data: 2D list. Sample data (must contain at least 8 elements). Returns: 2D list. Test statistic and p-value, or an error message (str) if input is invalid. This example function is provided as-is without any representation of accuracy. """ # Validate input is a 2D list with at least 8 elements if not isinstance(data, list) or len(data) < 8: return "Invalid input: data must be a 2D list with at least 8 elements." try: # Flatten 2D list to 1D flat = [float(row[0]) if isinstance(row, list) and len(row) == 1 else float(row) for row in data] except Exception: 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) # Check for nan/inf if any([x != x or x == float('inf') or x == float('-inf') for x in [stat, pval]]): return "Invalid result: nan or inf encountered." return [[stat, pval]] except Exception as e: return f"scipy.stats.skewtest error: {e}"

Example Workbook

Link to Workbook

Last updated on