# Ryan-Joiner test for normality in MATLAB

I have been reading about comparing Anderson-Darling, Ryan-Joiner and Kolmogorov-Smirnov tests at the Minitab blog, Anderson-Darling, Ryan-Joiner, or Kolmogorov-Smirnov: Which Normality Test Is the Best?.

MATLAB provides functions for Anderson-Darling and K-S (one-sample) tests but not for Ryan-Joiner. Could anyone please explain the steps to implement this test?

From the description at the link above, the R-J test sounds very useful. So, I am surprised that MATLAB didn't find it useful enough to provide a function!

• I suggest you emphasize that your question is about how the test works in step-by-step detail. While that seems clear enough to me ("explain the steps"), your post is receiving close votes** so it should be made clearer. $\quad$ ** presumably on the basis that you seem to be asking about Matlab code -- but given the form of the question, it requires statistical expertise, so could well be on topic in any case. Commented Apr 23, 2015 at 22:33

The Ryan-Joiner test is essentially equivalent to the Shapiro-Francia test; specifically, $W'$ is essentially identical to $R_p^2$ -- Ryan and Joiner (1973) point out the difference is only the difference between the expected values of the standardized normal order statistics vs normal percentage points.

Outside of Minitab documentation, few people would bother about that distinction (most people would rarely fuss over the difference when discussing Q-Q plots for example, calling a plot based on either a Q-Q plot); indeed at $n=20$ $R_p$ and $\sqrt{W'}$ will often agree to three or four significant figures, and they become closer as $n$ increases.

You may be able to locate an implementation of the Shapiro-Francia in Matlab (I know it exists for R, for example), but the situations of interest where $W'$ or $R_p$ will outperform the Shapiro-Wilk $W$ are relatively rare, so if you have access to the Shapiro-Wilk you would generally prefer it (the Shapiro Wilk uses a little more information).

[Edit: see here for a S-F implementation in Matlab.]

Johnson and Verrill (1991) have some useful discussion of the relationship.

I've included a number of references, including papers of Royston's which contain some useful details on calculating p-values for $W'$ (alternatively, one can always resort to simulation, or look to approximations - I think some are mentioned by Ryan and Joiner).

References

Shapiro S.S., Francia R.S. (1972).
"An approximate analysis of variance test for normality."
Journal of the American Statistical Association, 67: 215-216.

Ryan, T. and B. Joiner (1973),
"Normal probability plots and tests for normality,"
Tech. Rept., Pennsylvania State Univ. (University Park, PA). see this pdf
(Beware, the $'$ has been lost from $W'$ in numerous places in that linked document, making it difficult to tell in many places whether $W$ or $W'$ is being discussed, or which is which in tables.

Smith, R.M. and L.J. Bain (1976).
"Correlation type goodness-of-fit statistics with censored sampling,"
Comm. Statist. - Theory Method AS, 119-132.

Royston JP (1983),
"A simple method for evaluating the Shapiro-Francia W’ test of non-normality." The Statistician (JRSS-D) 32:297-300.

Royston, P. (1993);
"A pocket-calculator algorithm for the Shapiro-Francia test for non-normality: an application to medicine."
Statistics in Medicine, 12, 181–184.

Johnson R.A., and Verrill, S (1991),
"The large sample distribution of the Shapiro-Wilk statistic and its variants under Type I or Type II censoring,"
Statistics & Probability Letters 12 (November) 405-413
http://www1.fpl.fs.fed.us/spl1991.pdf

• Thank you Glen_b for explaining the steps and nuances of this test. Shapiro-Francia is indeed available at MATLAB Central File Exchange. Thanks for providing detailed references that I can refer to for more details! ~RD
– r2d2
Commented Apr 24, 2015 at 0:22