## D2 Function

computes the expected value of the sample range.

*Syntax*

**D2**(*n*)
where *n* is the sample size, with .

*Description*

The D2 function returns the expected value of the sample range of
*n* independent, normally distributed random variables with the same
mean and a standard deviation of 1. This expected value is referred
to as the control chart constant *d*_{2}. The values returned by the
D2 function are accurate to ten decimal places.
The value *d*_{2} can be expressed as

where is the standard normal cumulative distribution
function. Refer to Tippett (1925). In other chapters, *d*_{2} is
written as *d*_{2}(*n*) to emphasize the dependence on *n*.

In the SHEWHART procedure, *d*_{2} is used to calculate control
limits for *r* charts, and it is used in the estimation of the
process standard deviation based on subgroup ranges. Also refer
to the *ASQC Glossary and Tables for Statistical Quality Control*,
the *ASTM Manual on Presentation of Data and Control Chart Analysis*, Kume (1985),
Montgomery (1996), and Wadsworth and others (1986).

You can use the constant *d*_{2} to calculate an unbiased estimate
of the standard deviation of a normal
distribution from the sample range of *n* observations:

Note that the statistical efficiency of this estimate relative
to that of the sample standard deviation decreases as
*n* increases.

*Examples*

The following statements result in a value of 2.3259289473:

data;
constant=d2(5);
put constant;
run;

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.