hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_normal_scores_approx (g01db)

Purpose

nag_stat_normal_scores_approx (g01db) calculates an approximation to the set of Normal Scores, i.e., the expected values of an ordered set of independent observations from a Normal distribution with mean 0.00.0 and standard deviation 1.01.0.

Syntax

[pp, ifail] = g01db(n)
[pp, ifail] = nag_stat_normal_scores_approx(n)

Description

nag_stat_normal_scores_approx (g01db) is an adaptation of the Applied Statistics Algorithm AS 177.3177.3, see Royston (1982). If you are particularly concerned with the accuracy with which nag_stat_normal_scores_approx (g01db) computes the expected values of the order statistics (see Section [Accuracy]), then nag_stat_normal_scores_exact (g01da) which is more accurate should be used instead at a cost of increased storage and computing time.
Let x(1),x(2),,x(n)x(1),x(2),,x(n) be the order statistics from a random sample of size nn from the standard Normal distribution. Defining
Pr,n = Φ(E(x(r)))
Pr,n=Φ(-E(x(r)))
and
Qr,n = (rε )/(n + γ ),   r = 1,2,,n,
Qr,n=r-ε n+γ ,   r= 1,2,,n,
where E(x(r))E(x(r)) is the expected value of x(r)x(r), the current function approximates the Normal upper tail area corresponding to E(x(r))E(x(r)) as,
r,n = Qr,n + (δ1)/nQr,nλ + (δ2)/nQr,n2λCr,n.
P~r,n=Qr,n+δ1nQr,nλ+δ2nQr,n 2λ-Cr,n.
for r = 1,2,3r=1,2,3, and r4r4. Estimates of εε, γγ, δ1δ1, δ2δ2 and λλ are obtained. A small correction Cr,nCr,n to r,nP~r,n is necessary when r7r7 and n20n20.
The approximation to E(X(r))E(X(r)) is thus given by
E (x(r)) = Φ1 ( r , n ) , r = 1,2,,n .
E ( x (r) ) = - Φ-1 ( P ~ r , n ) , r =1,2,,n .
Values of the inverse Normal probability integral Φ1Φ-1 are obtained from nag_stat_inv_cdf_normal (g01fa).

References

Royston J P (1982) Algorithm AS 177: expected normal order statistics (exact and approximate) Appl. Statist. 31 161–165

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the size of the sample.
Constraint: n1n1.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     pp(n) – double array
The Normal scores. pp(i)ppi contains the value E(x(i))E(x(i)), for i = 1,2,,ni=1,2,,n.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,n < 1n<1.

Accuracy

For n2000n2000, the maximum error is 0.00010.0001, but nag_stat_normal_scores_approx (g01db) is usually accurate to 55 or 66 decimal places. For nn up to 50005000, comparison with the exact scores calculated by nag_stat_normal_scores_exact (g01da) shows that the maximum error is 0.0010.001.

Further Comments

The time taken by nag_stat_normal_scores_approx (g01db) is proportional to nn.

Example

function nag_stat_normal_scores_approx_example
n = int64(10);
[pp, ifail] = nag_stat_normal_scores_approx(n)
 

pp =

   -1.5388
   -1.0014
   -0.6561
   -0.3757
   -0.1227
    0.1227
    0.3757
    0.6561
    1.0014
    1.5388


ifail =

                    0


function g01db_example
n = int64(10);
[pp, ifail] = g01db(n)
 

pp =

   -1.5388
   -1.0014
   -0.6561
   -0.3757
   -0.1227
    0.1227
    0.3757
    0.6561
    1.0014
    1.5388


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013