Code covered by the BSD License  

Highlights from
DagosPtest

4.8

4.8 | 5 ratings Rate this file 18 Downloads (last 30 days) File Size: 2.75 KB File ID: #3954

DagosPtest

by Antonio Trujillo-Ortiz

 

12 Sep 2003 (Updated 21 Dec 2006)

D'Agostino-Pearson's K2 test for assessing normality of a data vector.

| Watch this File

File Information
Description

The D'Agostino-Pearson's K2 test is used to assessing normality of data using skewness and kurtosis. It approximates to the chi-squared distribution.

File needs to input the data vector and significance level (default = 0.05).
It outputs whether or not the normality is met.

MATLAB release MATLAB 5.3 (R11)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
05 May 2004 Faraaz Yusufi

I read about this test in Zar's book and wanted to use it in matlab. Thanks for implementing this in matlab, it works fine and is very useful.

05 Aug 2004 C Lynam

Works perfectly. nb, Calls on a few other files such as chi2cdf, distchck and chi2test.

28 Nov 2006 enrique buendia

is x2=2.284957205
not x2=3.1397
in your example code.

18 Jul 2008 Leandro Navarro Pablo

Thanks a lot. I have implemented it in my scripts and works nicely.

04 Dec 2008 Bahriye Basturk Akay

Thanks for implementing this function. it helped me a lot.

03 Nov 2009 Joseph Boomer

Downloaded and ran it today. Many thanks.

24 Jun 2011 A. M. Winkler

Hi,

This is a nice tool. However, I'm afraid there may be a small, but important error in the code. On the expression that defines H, line 117:

H = ((n-2)*(n-3)*abs(g2))/((n+1)*(n-1)*sqrt(G));

it should instead be:

H = ((n-2)*(n-3)*g2)/((n+1)*(n-1)*sqrt(G));

There is no need to use abs() here, as it will remove the sign and make the test produce incorrect results in approximately 50% of the cases.

If in doubt, please see the Equation 16 on D'Agostino RB, Belanger A & D'Agostino Jr RB, 1990. The American Statistician, 44(4), pp.316-21, and also the Equation 4 on D'Anscombe FJ & Glynn WJ, 1983. Biometrika, 70(1), p.227-34. This second paper is where the actual equation is coming from.

The correct results for your example are, therefore, K^2 = 4.3931, with a p-value of 0.1112.

Hope this helps!

A.

Please login to add a comment or rating.
Updates
16 Sep 2003

It was added an appropriate format to cite this file.

19 Sep 2003

In case of, it was added the warning: significance level must be between 0 and 1.

02 Oct 2003

Updating was made to reduce the record of data in a frequency form on only 3 lines.

21 Dec 2006

Text was improved.

Tag Activity for this File
Tag Applied By Date/Time
statistics Antonio Trujillo-Ortiz 22 Oct 2008 07:07:31
probability Antonio Trujillo-Ortiz 22 Oct 2008 07:07:31
normality test Antonio Trujillo-Ortiz 22 Oct 2008 07:07:31
dagostinopearson test Antonio Trujillo-Ortiz 22 Oct 2008 07:07:31
assessing normality Antonio Trujillo-Ortiz 22 Oct 2008 07:07:31

Contact us at files@mathworks.com