PDF version (NAG web site
, 64-bit version, 64-bit version)
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 and standard deviation .
Syntax
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,
, 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
, let
be the expected value of the
th largest order statistic, then:
(a) |
for any , |
(b) |
|
(c) |
the trace of is |
(d) |
where , and . 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:
– int64int32nag_int scalar
-
, the sample size.
Constraint:
.
- 2:
– double scalar
-
The expected value of the largest Normal order statistic, , from a sample of size .
- 3:
– double scalar
-
The expected value of the second largest Normal order statistic, , from a sample of size .
- 4:
– double scalar
-
The sum of squares of the expected values of the Normal order statistics from a sample of size .
Optional Input Parameters
None.
Output Parameters
- 1:
– double array
-
The upper triangle of the by variance-covariance matrix packed by column. Thus element is stored in , for .
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
For , where comparison with the exact values can be made, the maximum error is less than .
Further Comments
The time taken by nag_stat_normal_scores_var (g01dc) is approximately proportional to .
The arguments
(
),
(
) and
(
) 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
A program to compute the variance-covariance matrix for a sample of size
.
nag_stat_normal_scores_exact (g01da) is called to provide values for
exp1,
exp2 and
sumssq.
Open in the MATLAB editor:
g01dc_example
function g01dc_example
fprintf('g01dc example results\n\n');
n = int64(6);
etol = 1e-4;
[pp, errest, ifail] = g01da(n, etol);
sumssq = dot(pp,pp);
exp1 = pp(n);
exp2 = pp(n-1);
[vec, ifail] = g01dc(n, exp1, exp2, sumssq);
fprintf('Sample size = %4d\n', n);
fprintf('Variance-covariance matrix\n');
k = 1;
for j = 1:n
fprintf('%8.3f',vec(k:(k+j-1)));
fprintf('\n');
k = k + j;
end
g01dc example results
Sample size = 6
Variance-covariance matrix
0.416
0.209 0.280
0.139 0.189 0.246
0.102 0.140 0.183 0.246
0.077 0.106 0.140 0.189 0.280
0.056 0.077 0.102 0.139 0.209 0.416
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015