Most statistical programmers have seen a graph of a normal distribution that approximates a binomial distribution. The figure is often accompanied by a statement that gives guidelines for when the approximation is valid. For example, if the binomial distribution describes an experiment with n trials and the probability of success for each trial is p, then the quantity np(1-p) must be larger than some cutoff (often 5 is used, but sometimes 10) for the approximation to be valid.

The following SAS/IML statements compute the binomial probabilities for n=50 and p=0.8 (so that np(1-p)=8) and for the approximating normal curve, which has mean np and variance np(1-p). These values are plotted by the SGPLOT procedure (SGPLOT statements not shown):

```proc iml; n = 50; /* number of trials: better approx for 100, 200, etc. */ p = 0.8; /* probability of success for each trial */ mu = n*p;/* classic approximation of binomial pdf by normal pdf */ stddev = sqrt(n*p*(1-p)); xMin = mu - 4*stddev; xMax = mu+4*stddev; x1 = T(floor(xMin):ceil(xMax)); /* evaluate binomial at integers */ y1 = pdf("Binom", x1, p, n); x2 = T(do(xMin, xMax, (xMax-xMin)/101)); y2 = pdf("Normal", x2, mu, stddev); /* write values to SAS data set; plot with SGPLOT */```

The approximation looks good. However, the figure suggests that you need to be careful if you use a normal distribution to approximate extreme quantiles (such as 0.01 or 0.99) of the binomial distribution. Although the "middles" of the two distributions agree well, there appears to be less agreement in the tails. Also, recall that the quantiles of a discrete distribution are integers, which provides yet another source of error when approximating a binomial quantile with a normal quantile. This is evident when you overlay the normal CDF on the binomial CDF, as in the following figure:

```prob = T( do(0.01, 0.99, 0.005) ); q = quantile("binom", prob, p, n); /* ALWAYS an integer! */ qNormal = quantile("normal", prob, mu, stddev); diff = q - qNormal; /* error from approximating binomial quantiles */ /* write values to SAS data set; plot with SGPLOT */```

The graph shows that there is considerable error for quantiles near zero and one. Is this important? It can be. For example, if you are creating a funnel plot for proportions the curves on the funnel plot are computed with the quantiles 0.001, 0.025, 0.975, and 0.999. These are extreme quantiles, but they are used to compute the funnel-like control limits, which are the most important feature of the plot. I suspect this is why David Spiegelhalter in his paper "Funnel plots for comparing institutional performance" used a rather complicated formula (in Appendix A.1.1) to interpolate the binomial quantiles in the funnel plot for proportions, rather than using a binomial approximation.

The following graph shows a close-up of the values of the binomial quantiles versus the normal approximation for the extreme quantiles near one. These are the values used to compute the upper control limits in a funnel plot. You can see that the normal approximation exhibits a systematic error, due to differences in the size of the binomial and normal tails.

The lesson is this: even though it is common to use a normal distribution to approximate the binomial, the extreme quantiles of the distributions might not be close. Even when np(1-p) is fairly large, there are still sizeable differences in the values of the extreme quantiles of the distributions.

Share

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

• ```proc iml; n = 50; /* number of trials: better approx for 100, 200, etc. */ p = 0.8; /* probability of success for each trial */ mu = n*p;/* classic approximation of binomial pdf by normal pdf */ stddev = sqrt(n*p*(1-p)); xMin = mu - 4*stddev; xMax = mu+4*stddev; x1 = T(floor(xMin):ceil(xMax)); /* evaluate binomial at integers */ y1 = pdf("Binom", x1, p, n); x2 = T(do(xMin, xMax, (xMax-xMin)/101)); y2 = pdf("Normal", x2, mu, stddev); /* write values to SAS data set; plot with SGPLOT */ create HistPlot var {x1 y1 x2 y2}; append; close;   prob = T( do(0.01, 0.99, 0.005) ); q = quantile("binom", prob, p, n); /* ALWAYS an integer! */ qNormal = quantile("normal", prob, mu, stddev); diff = q - qNormal; /* error from approximating binomial quantiles */ /* write values to SAS data set; plot with SGPLOT */ create CDFPlot var {prob q qNormal}; append; close; quit;   title "Binomial vs Normal PDF (n=50; p=0.8)"; proc sgplot data=HistPlot; series x=x2 y=y2 / legendlabel="Normal"; needle x=x1 y=y1 / markers legendlabel="Binomial"; xaxis label="x"; yaxis label="Density"; run;   title "Quantiles: Binomial vs Normal (n=50; p=0.8)"; proc sgplot data=CDFPlot; series x=prob y=qNormal / legendlabel="Normal Qntl"; scatter x=prob y=q / legendlabel="Binomial Qntl"; xaxis label="Probability"; yaxis label="Binomial Qntl"; run;   /* ZOOM IN: use finer divisions for tail distribution */ proc iml; n = 50; /* number of trials: better approx for 100, 200, etc. */ p = 0.8; /* probability of success for each trial */ mu = n*p;/* classic approximation of binomial pdf by normal pdf */ stddev = sqrt(n*p*(1-p)); prob = T( do(0.95, 0.999, 0.001) ); q = quantile("binom", prob, p, n); /* ALWAYS an integer! */ qNormal = quantile("normal", prob, mu, stddev); /* write values to SAS data set; plot with SGPLOT */ create CDFPlot2 var {prob q qNormal}; append; close; quit;   title "Quantiles in Tail: Binomial vs Normal (n=50; p=0.8)"; proc sgplot data=CDFPlot2; series x=prob y=qNormal / legendlabel="Normal Qntl"; scatter x=prob y=q / legendlabel="Binomial Qntl"; xaxis label="Probability" min=0.95 max=1; yaxis label="Binomial Qntl" min=44; run;```