Code covered by the BSD License  

Highlights from
Shapiro-Wilk and Shapiro-Francia normality tests.

4.875

4.9 | 9 ratings Rate this file 83 Downloads (last 30 days) File Size: 3.73 KB File ID: #13964

Shapiro-Wilk and Shapiro-Francia normality tests.

by Ahmed Ben Saïda

 

15 Feb 2007 (Updated 14 Dec 2007)

Shapiro-Wilk & Shapiro-Francia parametric hypothesis test of composite normality.

| Watch this File

File Information
Description

Shapiro-Wilk parametric hypothesis test of composite normality, for sample size 3<= n <= 5000. Based on Royston R94 algorithm.
This test also performs the Shapiro-Francia normality test for platykurtic samples.

Required Products Statistics Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
06 Mar 2007 Gleb Tcheslavski  
24 Feb 2008 Jim Rohlf

I just tried it on some test data (n=16) and it crashed because the value of the variable newSWstatistic was imaginary.

28 Feb 2008 Jim Rohlf

Sorry, the file seems ok. My problem was that I had an out-of-date copy of the distchck.m file on my computer.

23 Mar 2008 Lars Hoffmann

I have the impression, that this implementation is more liberal than it should be according to literature. On 1000 runs at 0.1-level with various sample sizes I calculated an average empirical alpha of 0.11.

14 Apr 2008 NIZAR OUARTI

good comments,easy to use and reference of the algorythm is present.

04 Dec 2008 Bahriye Basturk Akay

thanks for implementing the code for Shapiro-Wilk and Shapiro-Francia normality tests.

10 Feb 2009 Raghav  
23 Feb 2010 Jared Lou

Has anyone Tried to Validate this other than LARS?

26 Aug 2010 steven pav

I tested this code for sample sizes as small as 4, and as large as 4096. at all levels tested, the p-values were fairly uniform. Thus it appears this test maintains the nominal rejection rate very well. (the Anderson-Darling test has similarly good performance for small sample sizes.)

21 Dec 2010 Ricardo Luis

I tested this code but I have a doubt. In line 119, the kurtosis computation seems to be for a population (kurtosis(x)) and not for a sample (kurtosis(x,0)). So, in line 119 shouldn't it be "if kurtosis(x,0)> 3" (flag=0)?
Thanks.

14 Jun 2011 rui

i am unable to test the code with my data, and i don't know why.

13 Mar 2012 Jannick  
Please login to add a comment or rating.
Updates
03 Dec 2007

Change the value in line 136 to 0.26758 instead of 0.026758 (Shapiro-Francia) to correct the significance level. Thanks to Kent Parsons for his remarks.

14 Dec 2007

Change the value in line 136 to 0.26758 instead of 0.026758 (Shapiro-Francia) to correct the significance level. Thanks to Kent Parsons for his remarks.

Tag Activity for this File
Tag Applied By Date/Time
statistics Ahmed Ben Saïda 22 Oct 2008 09:00:48
probability Ahmed Ben Saïda 22 Oct 2008 09:00:48
normality test Ahmed Ben Saïda 22 Oct 2008 09:00:48
hypothesis test Ahmed Ben Saïda 22 Oct 2008 09:00:48
pro Ahmed Ben Saïda 22 Oct 2008 09:00:48
algorithm Ahmed Ben Saïda 22 Oct 2008 09:00:48
composite Ahmed Ben Saïda 22 Oct 2008 09:00:48
normality test Mason Freed 18 May 2009 16:46:48
pro Andrew King 11 Mar 2011 12:47:09

Contact us at files@mathworks.com