File:Shapiro-Wilk Simulated CDF for n = 5, 10, 15, ..., 50.svg

Original file(SVG file, nominally 960 × 675 pixels, file size: 499 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

Description
English: Recreation of Fig. 4 from Shapiro and Wilk (1965). Basically, the emprical CDF of test results (and resultant p-values) for various sample sizes. Generated by repeated resampling from a large number of normal variates. Not truly an empirical CDF for the test because the correspondence displayed was produced w/ Royston's exact test.
plotPvalues <- function() {
  l.norm <- rnorm(5000)
  shap.n <- function(n) {
    replicate(2000, unlist(shapiro.test(sample(l.norm, n, replace = TRUE))[c(1,2)]))
  }
  shap.l <- mapply(shap.n, seq(5, 50, 5), SIMPLIFY = FALSE)
  plot(seq(0,1,length.out = 10), seq(0.7, 1, length.out = 10), type = "n",
       xlab = "P",
       ylab = "W",
       main = "Simulated Empirical CDF for n = 5, 10, 15, ..., 50") 
  abline(v = seq(0, 1, length.out = 11), lty = 3, col = "grey")
  abline(h = seq(0.7, 1, length.out = 7), lty = 3, col = "grey")
  text(rep(0.21, 4), c(0.84, 0.88, 0.91, 0.98), labels = c("n = 5", "n = 10", "n = 15", "n = 50"), cex = 0.9)
  for (n in 1:10) {
    lines(sort(shap.l[[n]][2, ]), sort(shap.l[[n]][1, ]), col = rgb(red = (1 - 5*n/50), green = 0, blue = 5*n/50))
  }
}

The above is a copy from the gist on GitHub as of 21:41, 22 April 2012 (UTC). The gist may be updated in the future so always compare the two when attempting to recreate the image.

  • Shapiro, S. S.; Wilk, M. B. (1965). "An analysis of variance test for normality (complete samples)". Biometrika 52 (3-4): 591–611
  • Patrick Royston (1982) An extension of Shapiro and Wilk's W test for normality to large samples. Applied Statistics, 31, 115–124.
Date
Source Own work
Author Protonk

Licensing edit

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
 
This W3C-unspecified chart was created with R.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current07:03, 12 February 2012Thumbnail for version as of 07:03, 12 February 2012960 × 675 (499 KB)Protonk (talk | contribs)

The following page uses this file:

Metadata