Dew Stats Master .NET
ShapiroWilks Routine
Summary
The Shapiro-Wilks test for normality of data.

Unit
Statistics

Declaration
Function ShapiroWilks(Data: TVec; out hRes: THypothesisResult; out Signif: TSample; hType: THypothesisType = htTwoTailed; Alpha: TSample = 0.05): TSample;
 Parameter  Description 
Data Data vector, containing ordered and unique deviates from unknown distribution. Data Length must be betweeen 3 and 5000, otherwise an execption is raised. 
hRes Returns the result of the null hypothesis (default assumption is that data comes from normal distribution). 
hType Defines the type of the null hypothesis (left, right and two - tailed). 
Signif (Significance level) returns the probability of observing the given result by chance given that the null hypothesis is true. 
Alpha Defines the desired significance level. If the significance probability (Signif) is bellow the desired significance (Alpha), the null hypothesis is rejected. 
Result
the Shapiro-Wilks statistics.
Description
Performs the The Shapiro-Wilks test for normality of data.
Categories
Hypothesis testing
 See Also 
Unique 
ShapiroFrancia 

Example 1

In this example we'll use ShapiroWilks test to determine if data is coming from normal distribution.

Uses MtxExpr, Math387, Statistics; procedure Example; var avec,bvec: Vector; hres: THypothesisResult; Signif: TSample; 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;
#include "MtxVecCpp.h" #include "Math387.hpp" #include "Statistics.hpp" void __fastcall Example(); { Vector a,b; a->Size(1000,false); RandomWeibull(2.5,1.0,a); // filter original data, retain only sorted unique values Unique(a,b); THypothesisResult hres; double sign; ShapiroWilks(b,hres, sign,htTwoTailed,0.05); // Significance approx. 0 // hres = hrReject -> data is not coming from normal distribution }
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector a = new Vector(0); Vector b = new Vector(0); a.Size(1000,false); StatRandom.RandomWeibull(2.5,1.0,a); // filter original data, retain only sorted unique values Statistics.Unique(a,b); THypothesisResult hres; double sign; ShapiroWilks(b,out hres, out sign,THypothesisType.htTwoTailed,0.05); // Significance approx. 0 // hres = hrReject -> data is not coming from normal distribution } }


Copyright 2008 Dew Research
http://www.dewresearch.com