g01da computes a set of Normal scores, i.e., the expected values of an ordered set of independent observations from a Normal distribution with mean $0.0$ and standard deviation $1.0$.

# Syntax

C# |
---|

public static void g01da( int n, double[] pp, double etol, out double errest, out int ifail ) |

Visual Basic |
---|

Public Shared Sub g01da ( _ n As Integer, _ pp As Double(), _ etol As Double, _ <OutAttribute> ByRef errest As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |

Visual C++ |
---|

public: static void g01da( int n, array<double>^ pp, double etol, [OutAttribute] double% errest, [OutAttribute] int% ifail ) |

F# |
---|

static member g01da : n : int * pp : float[] * etol : float * errest : float byref * ifail : int byref -> unit |

#### Parameters

- n
- Type: System..::..Int32
*On entry*: $n$, the size of the set.*Constraint*: ${\mathbf{n}}>0$.

- pp
- Type: array<System..::..Double>[]()[][]An array of size [n]
*On exit*: the Normal scores. ${\mathbf{pp}}\left[\mathit{i}-1\right]$ contains the value $E\left({x}_{\left(\mathit{i}\right)}\right)$, for $\mathit{i}=1,2,\dots ,n$.

- etol
- Type: System..::..Double
*On entry*: the maximum value for the estimated absolute error in the computed scores.*Constraint*: ${\mathbf{etol}}>0.0$.

- errest
- Type: System..::..Double%
*On exit*: a computed estimate of the maximum error in the computed scores (see [Accuracy]).

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

If a sample of $n$ observations from any distribution (which may be denoted by ${x}_{1},{x}_{2},\dots ,{x}_{n}$), is sorted into ascending order, the $r$th smallest value in the sample is often referred to as the $r$th ‘

**order statistic**’, sometimes denoted by ${x}_{\left(r\right)}$ (see Kendall and Stuart (1969)).The order statistics therefore have the property

(If $n=2r+1$, ${x}_{r+1}$ is the sample median.)

$${x}_{\left(1\right)}\le {x}_{\left(2\right)}\le \dots \le {x}_{\left(n\right)}\text{.}$$ |

For samples originating from a known distribution, the distribution of each order statistic in a sample of given size may be determined. In particular, the expected values of the order statistics may be found by integration. If the sample arises from a Normal distribution, the expected values of the order statistics are referred to as the ‘

**Normal scores**’. The Normal scores provide a set of reference values against which the order statistics of an actual data sample of the same size may be compared, to provide an indication of Normality for the sample (see (G01AHF not in this release)). Normal scores have other applications; for instance, they are sometimes used as alternatives to ranks in nonparametric testing procedures.g01da computes the $r$th Normal score for a given sample size $n$ as

where

and $\beta $ denotes the complete beta function.

$$E\left({x}_{\left(r\right)}\right)=\underset{-\infty}{\overset{\infty}{\int}}{x}_{r}d{G}_{r}\text{,}$$ |

$$d{G}_{r}=\frac{{A}_{r}^{r-1}{\left(1-{A}_{r}\right)}^{n-r}d{A}_{r}}{\beta \left(r,n-r+1\right)}\text{, \hspace{1em}}{A}_{r}=\frac{1}{\sqrt{2\pi}}\underset{-\infty}{\overset{{x}_{r}}{\int}}{e}^{-{t}^{2}/2}dt\text{, \hspace{1em}}r=1,2,\dots ,n\text{,}$$ |

The method attempts to evaluate the scores so that the estimated error in each score is less than the value etol specified by you. All integrations are performed in parallel and arranged so as to give good speed and reasonable accuracy.

# References

Kendall M G and Stuart A (1969)

*The Advanced Theory of Statistics (Volume 1)*(3rd Edition) Griffin# Error Indicators and Warnings

Errors or warnings detected by the method:

- ${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}<1$.

- ${\mathbf{ifail}}=2$
On entry, ${\mathbf{etol}}\le 0.0$.

- ${\mathbf{ifail}}=3$

# Accuracy

Errors are introduced by evaluation of the functions $d{G}_{r}$ and errors in the numerical integration process. Errors are also introduced by the approximation of the true infinite range of integration by a finite range $\left[a,b\right]$ but $a$ and $b$ are chosen so that this effect is of lower order than that of the other two factors. In order to estimate the maximum error the functions $d{G}_{r}$ are also integrated over the range $\left[a,b\right]$. g01da returns the estimated maximum error as

$${\mathbf{errest}}=\underset{r}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left[\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\left|a\right|,\left|b\right|\right)\times \left|\underset{a}{\overset{b}{\int}}d{G}_{r}-1.0\right|\right]\text{.}$$ |

# Parallelism and Performance

None.

# Further Comments

# Example

The program below generates the Normal scores for samples of size $5$, $10$, $15$, and prints the scores and the computed error estimates.

Example program (C#): g01dae.cs