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_5pt_summary (g01al)

Purpose

nag_stat_5pt_summary (g01al) calculates a five-point summary for a single sample.

Syntax

[res, ifail] = g01al(x, 'n', n)
[res, ifail] = nag_stat_5pt_summary(x, 'n', n)

Description

nag_stat_5pt_summary (g01al) calculates the minimum, lower hinge, median, upper hinge and the maximum of a sample of nn observations.
The data consist of a single sample of nn observations denoted by xixi and let zizi, for i = 1,2,,ni=1,2,,n, represent the sample observations sorted into ascending order.
Let m = n/2 m= n2  if nn is even and ((n + 1))/2 (n+1) 2  if nn is odd,
and k = m/2 k= m2  if mm is even and ((m + 1))/2 (m+1) 2  if mm is odd.
Then we have
Minimum = z1=z1,  
Maximum = zn=zn,  
Median = zm=zm if nn is odd,
  = (zm + zm + 1)/2 = zm+zm+12 if nn is even, (1/2) 12
Lower hinge = zk=zk if mm is odd,
  = (zk + zk + 1)/2 = zk+zk+12 if mm is even, (1/2) 12
Upper hinge = znk + 1=zn-k+1 if mm is odd,
  = (znk + znk + 1)/2 = zn-k+zn-k+12 if mm is even.(1/2) 12

References

Erickson B H and Nosanchuk T A (1985) Understanding Data Open University Press, Milton Keynes
Tukey J W (1977) Exploratory Data Analysis Addison–Wesley

Parameters

Compulsory Input Parameters

1:     x(n) – double array
n, the dimension of the array, must satisfy the constraint n5n5.
The sample observations, x1,x2,,xnx1,x2,,xn.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the array x.
nn, number of observations in the sample.
Constraint: n5n5.

Input Parameters Omitted from the MATLAB Interface

iwrk

Output Parameters

1:     res(55) – double array
res contains the five-point summary.
res(1)res1
The minimum.
res(2)res2
The lower hinge.
res(3)res3
The median.
res(4)res4
The upper hinge.
res(5)res5
The maximum.
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 < 5n<5.

Accuracy

The computations are stable.

Further Comments

The time taken by nag_stat_5pt_summary (g01al) is proportional to nn.

Example

function nag_stat_5pt_summary_example
x = [12;
     9;
     2;
     5;
     6;
     8;
     2;
     7;
     3;
     1;
     11;
     10];
[res, ifail] = nag_stat_5pt_summary(x)
 

res =

    1.0000
    2.5000
    6.5000
    9.5000
   12.0000


ifail =

                    0


function g01al_example
x = [12;
     9;
     2;
     5;
     6;
     8;
     2;
     7;
     3;
     1;
     11;
     10];
[res, ifail] = g01al(x)
 

res =

    1.0000
    2.5000
    6.5000
    9.5000
   12.0000


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