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_var (g01dc)

Purpose

nag_stat_normal_scores_var (g01dc) computes an approximation to the variance-covariance matrix of an ordered set of independent observations from a Normal distribution with mean 0.00.0 and standard deviation 1.01.0.

Syntax

[vec, ifail] = g01dc(n, exp1, exp2, sumssq)
[vec, ifail] = nag_stat_normal_scores_var(n, exp1, exp2, sumssq)

Description

nag_stat_normal_scores_var (g01dc) is an adaptation of the Applied Statistics Algorithm AS 128, see Davis and Stephens (1978). An approximation to the variance-covariance matrix, VV, using a Taylor series expansion of the Normal distribution function is discussed in David and Johnson (1954).
However, convergence is slow for extreme variances and covariances. The present function uses the David–Johnson approximation to provide an initial approximation and improves upon it by use of the following identities for the matrix.
For a sample of size nn, let mimi be the expected value of the iith largest order statistic, then:
(a) for any i = 1,2,,ni=1,2,,n, j = 1nVij = 1j=1nVij=1
(b) V12 = V11 + mn2mnmn11V12=V11+mn2-mnmn-1-1
(c) the trace of VV is tr(V) = ni = 1nmi2tr(V)=n-i=1nmi2
(d) Vij = Vji = Vrs = VsrVij=Vji=Vrs=Vsr where r = n + 1ir=n+1-i, s = n + 1js=n+1-j and i,j = 1,2,,ni,j=1,2,,n. Note that only the upper triangle of the matrix is calculated and returned column-wise in vector form.

References

David F N and Johnson N L (1954) Statistical treatment of censored data, Part 1. Fundamental formulae Biometrika 41 228–240
Davis C S and Stephens M A (1978) Algorithm AS 128: approximating the covariance matrix of Normal order statistics Appl. Statist. 27 206–212

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the sample size.
Constraint: n > 0n>0.
2:     exp1 – double scalar
The expected value of the largest Normal order statistic, mnmn, from a sample of size nn.
3:     exp2 – double scalar
The expected value of the second largest Normal order statistic, mn1mn-1, from a sample of size nn.
4:     sumssq – double scalar
The sum of squares of the expected values of the Normal order statistics from a sample of size nn.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     vec(n × (n + 1) / 2n×(n+1)/2) – double array
The upper triangle of the nn by nn variance-covariance matrix packed by column. Thus element VijVij is stored in vec(i + j × (j1) / 2)veci+j×(j-1)/2, for 1ijn1ijn.
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 n20n20, where comparison with the exact values can be made, the maximum error is less than 0.00010.0001.

Further Comments

The time taken by nag_stat_normal_scores_var (g01dc) is approximately proportional to n2n2.
The arguments exp1exp1 ( = mn=mn), exp2exp2 ( = mn1=mn-1) and sumssqsumssq ( = j = 1nmj2=j=1nmj2) may be found from the expected values of the Normal order statistics obtained from nag_stat_normal_scores_exact (g01da) (exact) or nag_stat_normal_scores_approx (g01db) (approximate).

Example

function nag_stat_normal_scores_var_example
n = int64(6);
exp1 = 1.267206361712849;
exp2 = 0.641755038918563;
sumssq = 4.116565238504731;
[vec, ifail] = nag_stat_normal_scores_var(n, exp1, exp2, sumssq)
 

vec =

    0.4159
    0.2085
    0.2796
    0.1394
    0.1889
    0.2462
    0.1025
    0.1397
    0.1834
    0.2462
    0.0774
    0.1060
    0.1397
    0.1889
    0.2796
    0.0563
    0.0774
    0.1025
    0.1394
    0.2085
    0.4159


ifail =

                    0


function g01dc_example
n = int64(6);
exp1 = 1.267206361712849;
exp2 = 0.641755038918563;
sumssq = 4.116565238504731;
[vec, ifail] = g01dc(n, exp1, exp2, sumssq)
 

vec =

    0.4159
    0.2085
    0.2796
    0.1394
    0.1889
    0.2462
    0.1025
    0.1397
    0.1834
    0.2462
    0.0774
    0.1060
    0.1397
    0.1889
    0.2796
    0.0563
    0.0774
    0.1025
    0.1394
    0.2085
    0.4159


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