Declaration: ShapiroWilkTest (Data: TDoubleArray; NCens: integer; var pW: double; var WStat: double): integer;
The function ShapiroWilkTest applies a Shapiro-Wilk test for normality on the data contained in Data. The parameter NCens specifies the number of right censored data which are not contained in the data vector. On return the function provides both the Shapiro-Wilk test statistic (variable parameter WStat) and the level of significance in variable parameter pW.

The function returns one of the following error codes:

 0 ... no error
-1 ... number of uncensored observations < 3
-2 ... too many data points (measured data + number of censored data > 5000)
-4 ... invalid NCens
-5 ... the proportion of censored data is greater than 80%
-6 ... measured data have zero range

Hint: The ShapiroWilkTest routine is capable of dealing with right-censored data (indicated by NCens > 0). Left-censored data can be used equally well simply by changing the sign of all data in the vector Data.