Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersReturns
shapiro(x)

The Shapiro-Wilk test tests the null hypothesis that the data was drawn from a normal distribution.

Notes

The algorithm used is described in but censoring parameters as described are not implemented. For N > 5000 the W test statistic is accurate but the p-value may not be.

The chance of rejecting the null hypothesis when it is true is close to 5% regardless of sample size.

Parameters

x : array_like

Array of sample data.

Returns

statistic : float

The test statistic.

p-value : float

The p-value for the hypothesis test.

Perform the Shapiro-Wilk test for normality.

See Also

anderson

The Anderson-Darling test for normality

kstest

The Kolmogorov-Smirnov test for goodness of fit.

Examples

import numpy as np
from scipy import stats
rng = np.random.default_rng()
x = stats.norm.rvs(loc=5, scale=3, size=100, random_state=rng)
shapiro_test = stats.shapiro(x)
shapiro_test
shapiro_test.statistic
shapiro_test.pvalue
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

kstestkstestandersonanderson

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/stats/_morestats.py#1742
type: <class 'function'>
Commit: