PDF version (NAG web site
, 64bit version, 64bit version)
NAG Toolbox: nag_stat_normal_scores_exact (g01da)
Purpose
nag_stat_normal_scores_exact (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$0.0$ and standard deviation 1.0$1.0$.
Syntax
Description
If a sample of
n$n$ observations from any distribution (which may be denoted by
x_{1},x_{2}, … ,x_{n}${x}_{1},{x}_{2},\dots ,{x}_{n}$), is sorted into ascending order, the
r$r$th smallest value in the sample is often referred to as the
r$r$th ‘
order statistic’, sometimes denoted by
x_{(r)}${x}_{\left(r\right)}$ (see
Kendall and Stuart (1969)).
The order statistics therefore have the property
(If
n = 2r + 1$n=2r+1$,
x_{r + 1}${x}_{r+1}$ is the sample median.)
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
nag_stat_plot_scatter_normal (g01ah)).
Normal scores have other applications; for instance, they are sometimes used as alternatives to ranks in nonparametric testing procedures.
nag_stat_normal_scores_exact (g01da) computes the
r$r$th Normal score for a given sample size
n$n$ as
where
and
β$\beta $ denotes the complete beta function.
The function 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
Parameters
Compulsory Input Parameters
 1:
n – int64int32nag_int scalar
n$n$, the size of the set.
Constraint:
n > 0${\mathbf{n}}>0$.
 2:
etol – double scalar
The maximum value for the estimated absolute error in the computed scores.
Constraint:
etol > 0.0${\mathbf{etol}}>0.0$.
Optional Input Parameters
None.
Input Parameters Omitted from the MATLAB Interface
 work iw
Output Parameters
 1:
pp(n) – double array
The Normal scores.
pp(i)${\mathbf{pp}}\left(\mathit{i}\right)$ contains the value
E(x_{(i)})$E\left({x}_{\left(\mathit{i}\right)}\right)$, for
i = 1,2, … ,n$\mathit{i}=1,2,\dots ,n$.
 2:
errest – double scalar
A computed estimate of the maximum error in the computed scores (see
Section [Accuracy]).
 3:
ifail – int64int32nag_int scalar
ifail = 0${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see
[Error Indicators and Warnings]).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
 ifail = 1${\mathbf{ifail}}=1$

On entry,  n < 1${\mathbf{n}}<1$. 
 ifail = 2${\mathbf{ifail}}=2$
On entry,  etol ≤ 0.0${\mathbf{etol}}\le 0.0$. 
 W ifail = 3${\mathbf{ifail}}=3$
The function was unable to estimate the scores with estimated error less than
etol. The best result obtained is returned together with the associated value of
errest.
 ifail = 4${\mathbf{ifail}}=4$
On entry,  if n is even, iw < 3 × n / 2$\mathit{iw}<3\times {\mathbf{n}}/2$; 
or  if n is odd, iw < 3 × (n − 1) / 2$\mathit{iw}<3\times ({\mathbf{n}}1)/2$. 
Accuracy
Errors are introduced by evaluation of the functions
dG_{r}$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
[a,b]$[a,b]$ but
a$a$ and
b$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
dG_{r}$d{G}_{r}$ are also integrated over the range
[a,b]$[a,b]$.
nag_stat_normal_scores_exact (g01da) returns the estimated maximum error as
Further Comments
The time taken by
nag_stat_normal_scores_exact (g01da) depends on
etol and
n. For a given value of
etol the timing varies approximately linearly with
n.
Example
Open in the MATLAB editor:
nag_stat_normal_scores_exact_example
function nag_stat_normal_scores_exact_example
n = int64(5);
etol = 0.001;
[pp, errest, ifail] = nag_stat_normal_scores_exact(n, etol)
pp =
1.1630
0.4950
0
0.4950
1.1630
errest =
9.0800e09
ifail =
0
Open in the MATLAB editor:
g01da_example
function g01da_example
n = int64(5);
etol = 0.001;
[pp, errest, ifail] = g01da(n, etol)
pp =
1.1630
0.4950
0
0.4950
1.1630
errest =
9.0800e09
ifail =
0
PDF version (NAG web site
, 64bit version, 64bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013