Statistics.ShapiroWilks Method

function ShapiroWilks(const Data: TVec; out hRes: THypothesisResult; out Signif: Double; hType: THypothesisType; Alpha: Double): Double;

The Shapiro-Wilks test for normality of data.

#NameDescription
1DataData vector, containing ordered and unique deviates from unknown distribution. Data Length must be betweeen 3 and 5000, otherwise an execption is raised.
2hResReturns the result of the null hypothesis (default assumption is that data comes from normal distribution).
3hTypeDefines the type of the null hypothesis (left, right and two - tailed).
4Signif(Significance level) returns the probability of observing the given result by chance given that the null hypothesis is true.
5AlphaDefines the desired significance level. If the significance probability (Signif) is bellow the desired significance (Alpha), the null hypothesis is rejected.

Returns: Double - the Shapiro-Wilks statistics.

Remarks:

Performs the The Shapiro-Wilks test for normality of data.

Note
Basic assumption is Data values i.e. deviates from unknown distribution are ordered and unique.

Examples
Uses MtxExpr, Math387, Statistics;
procedure Example;
var avec,bvec: Vector;
hres: THypothesisResult;
Signif: double;
begin
    avec.Size(1000,false);
    RandomWeibull(2.5,1,avec);
    // filter original data, retain only sorted unique values
    Unique(avec,bvec);
    ShapiroWilks(bvec,hres,signif);
    // Significance approx. 0
    // hres = hrReject -> data is not coming from normal distribution
end;
See Also: Statistics.Unique, Statistics.ShapiroFrancia