g01al calculates a five-point summary for a single sample.

# Syntax

C#
```public static void g01al(
int n,
double[] x,
double[] res,
out int ifail
)```
Visual Basic
```Public Shared Sub g01al ( _
n As Integer, _
x As Double(), _
res As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g01al(
int n,
array<double>^ x,
array<double>^ res,
[OutAttribute] int% ifail
)```
F#
```static member g01al :
n : int *
x : float[] *
res : float[] *
ifail : int byref -> unit
```

#### Parameters

n
Type: System..::..Int32
On entry: $n$, number of observations in the sample.
Constraint: ${\mathbf{n}}\ge 5$.
x
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: the sample observations, ${x}_{1},{x}_{2},\dots ,{x}_{n}$.
res
Type: array<System..::..Double>[]()[][]
An array of size [$5$]
On exit: res contains the five-point summary.
${\mathbf{res}}\left[0\right]$
The minimum.
${\mathbf{res}}\left[1\right]$
The lower hinge.
${\mathbf{res}}\left[2\right]$
The median.
${\mathbf{res}}\left[3\right]$
The upper hinge.
${\mathbf{res}}\left[4\right]$
The maximum.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

g01al calculates the minimum, lower hinge, median, upper hinge and the maximum of a sample of $n$ observations.
The data consist of a single sample of $n$ observations denoted by ${x}_{i}$ and let ${z}_{i}$, for $i=1,2,\dots ,n$, represent the sample observations sorted into ascending order.
Let $m=\frac{n}{2}$ if $n$ is even and $\frac{\left(n+1\right)}{2}$ if $n$ is odd,
and $k=\frac{m}{2}$ if $m$ is even and $\frac{\left(m+1\right)}{2}$ if $m$ is odd.
Then we have
 Minimum $\text{}={z}_{1}$, Maximum $\text{}={z}_{n}$, Median $\text{}={z}_{m}$ if $n$ is odd, $\text{}=\frac{{z}_{m}+{z}_{m+1}}{2}$ if $n$ is even, $\phantom{\frac{1}{2}}$ Lower hinge $\text{}={z}_{k}$ if $m$ is odd, $\text{}=\frac{{z}_{k}+{z}_{k+1}}{2}$ if $m$ is even, $\phantom{\frac{1}{2}}$ Upper hinge $\text{}={z}_{n-k+1}$ if $m$ is odd, $\text{}=\frac{{z}_{n-k}+{z}_{n-k+1}}{2}$ if $m$ is even.$\phantom{\frac{1}{2}}$

# 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

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{n}}<5$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

The computations are stable.

# Parallelism and Performance

None.

The time taken by g01al is proportional to $n$.

# Example

This example calculates a five-point summary for a sample of $12$ observations.

Example program (C#): g01ale.cs

Example program data: g01ale.d

Example program results: g01ale.r