How to verify that simulated data is normally distributed? I have a program generating purportedly normal distributions and I would like to test it.  I have a number of issues; perhaps the experts here will help me sort out the essential from the inessential and answer most of these.


*I'm looking for a simple test, ideally -- one I can implement without too much trouble.

*There may be correlation between adjacent values. Some tests may not be sensitive to this failure if the data are 'otherwise' normally distributed.

*Ideally, I'd like to allow a (small!) amount of non-normality. Most tests I've seen allow slightly non-normal data to pass only because a small number of values are tested (where "small" might still mean millions, depending on the size of the deviation). This is reminiscent of this question about the value of normality testing.

 A: The issues arise with the idea of 'small' amounts of non-normality and 'some' autocorrelation.  Until it's clear how to operationalise these then you're stuck with tests of normality (not near normality).  There is, as you imply, quite a conceptual difference between an insensitive test of normality and a sensitive test of near normality.  You can use the first as the second, but it probably won't be quite right and will behave differently in various limits.  It seems to me you can proceed in two ways:
General normality tests do not allow you to control which aspects of non-normality to treat as more serious than others.  So can you define what aspect of normality is actually important?  If you are more concerned about, e.g. fat tails or skew then you could test for these separately. Similarly, if you estimate the first order autocorrelation you can use the confidence interval on that parameter to determine how much is 'too much'.  But you still have to decide what the correct order is (@Jason O. Jensen assumes it is one, but that will depend on the generation process) and whether you trust the test.  If I remember correctly, the size of different normality tests (e.g. KS and Shapiro-Wilks) vary with level autocorrelation, sometimes even depending on its sign.  And this in addition to the variation in their power with respect to various alternatives...
Second, you say that you generate the data yourself.  I'm imagining that either you are testing some kind of random number generator or you are wondering whether something has achieved an asymptotically normal distribution.  For the former case, you probably have some idea about what is likely to be wrong, so can test for that, as suggested above.  In the latter case, I have less intuition.  It is probable that the MCMC convergence literature has something useful to say about this case.
A: If point two is your primary concern you could 'lag' the data one observation and then regress the 'raw' data on the 'lagged' data. Do this for a lag each way and decide based on the p value whether the data is sufficiently random.
A: Another suggestion would be to compute the Kullback-Leiber divergence or Hellinger distance between your generated data and the normal distribution. That gives you a measure of how non-normal your data is (and hopefully you can determine what a small deviation from normality is).
A: The best test that I can think of for near-normality is the visual test in: 

 Buja, A., Cook, D. Hofmann, H., Lawrence, M. Lee, E.-K., Swayne,
 D.F and Wickham, H. (2009) Statistical Inference for exploratory
 data analysis and model diagnostics Phil. Trans. R. Soc. A 2009
 367, 4361-4383 doi: 10.1098/rsta.2009.0120


The vis.test function in the TeachingDemos package for R implements variations on this test.  This does assume that you either trust R's random normal generator to be good enough for comparison or that you have another source of normal enough for comparison.  This test cannot be automated, but is fairly straight forward and fits the ideas above (and you could find a way to look at the autocorrelation as well if desired).
