NAG Library Routine Document
g01alf
(five_point_summary)
1
Purpose
g01alf calculates a five-point summary for a single sample.
2
Specification
Fortran Interface
Integer, Intent (In) | :: |
n | Integer, Intent (Inout) | :: |
ifail | Integer, Intent (Out) | :: |
iwrk(n) | Real (Kind=nag_wp), Intent (In) | :: |
x(n) | Real (Kind=nag_wp), Intent (Out) | :: |
res(5) |
|
C Header Interface
#include nagmk26.h
void |
g01alf_ (
const Integer *n,
const double x[],
Integer iwrk[],
double res[],
Integer *ifail) |
|
3
Description
g01alf calculates the minimum, lower hinge, median, upper hinge and the maximum of a sample of observations.
The data consist of a single sample of observations denoted by and let , for , represent the sample observations sorted into ascending order.
Let if is even and if is odd,
and if is even and if is odd.
Then we have
Minimum |
, |
|
Maximum |
, |
|
Median |
|
if is odd, |
|
|
if is even, |
Lower hinge |
|
if is odd, |
|
|
if is even, |
Upper hinge |
|
if is odd, |
|
|
if is even. |
4
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
5
Arguments
- 1: – IntegerInput
-
On entry: , number of observations in the sample.
Constraint:
.
- 2: – Real (Kind=nag_wp) arrayInput
-
On entry: the sample observations, .
- 3: – Integer arrayWorkspace
-
- 4: – Real (Kind=nag_wp) arrayOutput
-
On exit:
res contains the five-point summary.
- The minimum.
- The lower hinge.
- The median.
- The upper hinge.
- The maximum.
- 5: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The computations are stable.
8
Parallelism and Performance
g01alf is not threaded in any implementation.
The time taken by g01alf is proportional to .
10
Example
This example calculates a five-point summary for a sample of observations.
10.1
Program Text
Program Text (g01alfe.f90)
10.2
Program Data
Program Data (g01alfe.d)
10.3
Program Results
Program Results (g01alfe.r)