# Test for "discrete normality"

I have implemented what I believe to be a sampler from a distribution over the integers. Its a specific discretization of the normal distribution so I know stuff like mean and variance of the theoretical distribution, and I can compute an approximate of the theoretical pmf but it's expensive so I can't do it for a lot of values. I'd like to gain some confidence that my sampler is actually sampling from the right distribution, preferably in a reproducible way (so no looking at histograms etc). what's a reasonable test for this?

I'm mostly overwhelmed by the variety of available statistics and the search for one that is defined for discrete distributions yet tells me something about "normality".

• Could you explain what might be "expensive" about computing the PMF? It could only be if you have millions of integers with appreciable probabilities, in which case you can replace the PMF by the Normal density to very great accuracy. If you just want to test the accuracy of your sampler, what's the matter with the standard Chi-squared test?
– whuber
Commented Jul 27, 2023 at 17:22
• @whuber You've anticipated that I meant what is sometimes termed the "significance level", but I should have indicated that for clarity. It is that very notion of 'acceptable' which seems nebulous to me without assigning it to be coupled to something non-arbitrary. I guess the OP will have to decide what they find acceptable. Commented Jul 27, 2023 at 17:53
• @Galen The most general concept of discretization I have run across is tantamount to a measurable transformation $h:[a,b]\to\mathcal D$ where $[a,b]$ is the support of a distribution $F$ and $\mathcal D$ is a discrete subset of real numbers. The discretization $[F]_h$ of $F$ has $\mathcal D$ for its support and for all $d\in\mathcal D,$ ${\Pr}_{[F]_h}(d)=\Pr(h(X)=d).$ (Always $h$ is monotonic, but it needn't be.) Thus, calculating these probabilities comes down to a calculation using $F.$ But whether anything like this is meant is a matter of speculation, because we haven't been told.
– whuber
Commented Jul 27, 2023 at 20:19
• Although the normalizing constant might be defined in terms of a sum (much as, say, the exponential function is defined as a sum), you don't need that sum to compute it. It is expressible in terms of a Jacobi Theta function, whose properties are well studied. Moreover, unless $\sigma$ is huge, there will be such a small number of terms in the sum that it can be approximated quickly with great accuracy with a finite partial sum. Just summing over $y$ for which $|y-\mu|\le 8\sigma,$ for instance, gives double precision results. This is why details matter!
– whuber
Commented Jul 27, 2023 at 21:05
• BTW, I believe a natural and extremely efficient method to sample from this distribution would use rejection sampling from the (obvious) dominating Gaussian distribution.
– whuber
Commented Jul 27, 2023 at 21:11