SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.distribution.normality

Class ShapiroWilkDistribution

• java.lang.Object
• com.numericalmethod.suanshu.stats.test.distribution.normality.ShapiroWilkDistribution
• All Implemented Interfaces:
ProbabilityDistribution

public class ShapiroWilkDistribution
extends Object
implements ProbabilityDistribution
Shapiro-Wilk distribution is the distribution of the Shapiro-Wilk statistics, which tests the null hypothesis that a sample comes from a normally distributed population.

This is an implementation of ALGORITHM AS R94. Although our implementation allows for sample size > 5000, its validity is not rigorously established.

• Patrick Royston, "A Remark on Algorithm AS 181: The W Test for Normality," Applied Statistics, 44, 547-551, 1995.
• Patrick Royston, "Approximating the Shapiro-Wilk W-test for non-normality," Statistics and Computing, Volume 2, Number 3, 117-119.
• Patrick Royston, "Algorithm AS 181: The W Test for Normality," Applied Statistics, 31, 176-180, 1982.
• Wikipedia: Shapiro-Wilk test
• Constructor Summary

Constructors
Constructor and Description
ShapiroWilkDistribution(int n)
Construct a Shapiro-Wilk distribution.
• Method Summary

All Methods
Modifier and Type Method and Description
double cdf(double W)
Gets the cumulative probability F(x) = Pr(X ≤ x).
double density(double x)
Deprecated.
double entropy()
Deprecated.
double kurtosis()
Deprecated.
double mean()
Deprecated.
double median()
Deprecated.
double moment(double x)
Deprecated.
double quantile(double u)
Deprecated.
double skew()
Deprecated.
double variance()
Deprecated.
• Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Constructor Detail

• ShapiroWilkDistribution

public ShapiroWilkDistribution(int n)
Construct a Shapiro-Wilk distribution.
Parameters:
n - the number of observations
• Method Detail

• mean

@Deprecated
public double mean()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the mean of this distribution.
Specified by:
mean in interface ProbabilityDistribution
Returns:
the mean
Wikipedia: Expected value
• median

@Deprecated
public double median()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the median of this distribution.
Specified by:
median in interface ProbabilityDistribution
Returns:
the median
Wikipedia: Median
• variance

@Deprecated
public double variance()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the variance of this distribution.
Specified by:
variance in interface ProbabilityDistribution
Returns:
the variance
Wikipedia: Variance
• skew

@Deprecated
public double skew()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the skewness of this distribution.
Specified by:
skew in interface ProbabilityDistribution
Returns:
the skewness
Wikipedia: Skewness
• kurtosis

@Deprecated
public double kurtosis()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the excess kurtosis of this distribution.
Specified by:
kurtosis in interface ProbabilityDistribution
Returns:
the excess kurtosis
Wikipedia: Kurtosis
• entropy

@Deprecated
public double entropy()
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the entropy of this distribution.
Specified by:
entropy in interface ProbabilityDistribution
Returns:
the entropy
Wikipedia: Entropy (information theory)
• cdf

public double cdf(double W)
Description copied from interface: ProbabilityDistribution
Gets the cumulative probability F(x) = Pr(X ≤ x).
Specified by:
cdf in interface ProbabilityDistribution
Parameters:
W - x
Returns:
F(x) = Pr(X ≤ x)
Wikipedia: Cumulative distribution function
• quantile

@Deprecated
public double quantile(double u)
Deprecated.
Description copied from interface: ProbabilityDistribution
Gets the quantile, the inverse of the cumulative distribution function. It is the value below which random draws from the distribution would fall u×100 percent of the time.

F-1(u) = x, such that
Pr(X ≤ x) = u

This may not always exist.
Specified by:
quantile in interface ProbabilityDistribution
Parameters:
u - u, a quantile
Returns:
F-1(u)
Wikipedia: Quantile function
• density

@Deprecated
public double density(double x)
Deprecated.
Description copied from interface: ProbabilityDistribution
The density function, which, if exists, is the derivative of F. It describes the density of probability at each point in the sample space.
f(x) = dF(X) / dx
This may not always exist.

For the discrete cases, this is the probability mass function. It gives the probability that a discrete random variable is exactly equal to some value.

Specified by:
density in interface ProbabilityDistribution
Parameters:
x - x
Returns:
f(x)
• moment

@Deprecated
public double moment(double x)
Deprecated.
Description copied from interface: ProbabilityDistribution
The moment generating function is the expected value of etX. That is,
E(etX)
This may not always exist.
Specified by:
moment in interface ProbabilityDistribution
Parameters:
x - t
Returns:
E(exp(tX))