NAG Library Routine Document
G01ASF
1 Purpose
G01ASF produces a specified number of box and whisker plots on a character printing device, with a chosen number of character positions in each direction.
2 Specification
SUBROUTINE G01ASF ( |
PRT, M, N, X, LDX, NSTEPX, NSTEPY, PLOT, LDPLOT, WORK, IWORK, IFAIL) |
INTEGER |
M, N(M), LDX, NSTEPX, NSTEPY, LDPLOT, IWORK(LDX), IFAIL |
REAL (KIND=nag_wp) |
X(LDX,M), WORK(5*M) |
CHARACTER(1) |
PRT, PLOT(LDPLOT,NSTEPX) |
|
3 Description
G01ASF produces a series of box and whisker plots representing data batches each of size , for . A box and whisker plot is a diagrammatic representation of the five-point summary of a data batch. The plot consists of a box spanning the hinges with the median indicated by a third line and two whiskers to represent the extreme values. The five-point summary is calculated internally and is returned in the workspace array.
The plot is returned in the character array
PLOT. The size of the plot may be controlled using the parameters
NSTEPX and
NSTEPY. Optionally the plot can be output to an external file, in which case output is directed to the current advisory message unit as defined by
X04ABF.
An axis corresponding to the axis is drawn and annotated and data points are plotted to the nearest character position.
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 Parameters
- 1: – CHARACTER(1)Input
-
On entry: indicates whether the box and whisker plot is to be output to an external file.
- The box and whisker plot is not output to an external file.
- The box and whisker plot is output to the current advisory message unit as defined by X04ABF.
Constraint:
or .
- 2: – INTEGERInput
-
On entry: , the number of data batches that are to be represented.
Constraint:
.
- 3: – INTEGER arrayInput
-
On entry:
contains the number of observations in the
th batch,
, for
.
If the th batch is omitted from the plot.
Constraint:
at least one must be greater than or equal to , for .
- 4: – REAL (KIND=nag_wp) arrayInput
-
On entry: the
th column of
X must contain the data for the
th batch, that is
must contain the
th observation of the
th batch, for
and
.
- 5: – INTEGERInput
-
On entry: the first dimension of the array
X and the dimension of the array
IWORK as declared in the (sub)program from which G01ASF is called.
Constraint:
.
- 6: – INTEGERInput
-
On entry: the number of character positions to be plotted in the -direction.
Constraint:
.
- 7: – INTEGERInput
-
On entry: the number of character positions to be plotted in the -direction.
Constraint:
.
- 8: – CHARACTER(1) arrayOutput
-
On exit: contains the box and whisker plots.
- 9: – INTEGERInput
-
On entry: the first dimension of the array
PLOT as declared in the (sub)program from which G01ASF is called.
Constraint:
.
- 10: – REAL (KIND=nag_wp) arrayOutput
-
On exit: , for , contains the five-point summary of the th batch.
- 11: – INTEGER arrayWorkspace
-
- 12: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction 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 parameter, 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, for some , for . For each batch where this occurs, crosses are plotted in a vertical line to indicate that insufficient data was provided to produce a five-point summary and box-plot for that particular batch.
-
On entry,
. This indicates that the data region defined by
NSTEPX is too small to produce the required plot.
-
-
-
-
On entry, , for .
-
The number of observations in all batches is less than .
-
On entry, the data values are all identical.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
If the range of observations in a particular batch is too small to allow each item of the five-point summary to be plotted separately, then a sequence of stars are plotted at the median point of the batch to indicate that the full box-plot could not be plotted.
8 Parallelism and Performance
Not applicable.
The time taken by G01ASF increases with and , for .
10 Example
The following program produces a box and whisker plot for each one of data batches of sizes , , , and respectively and prints the box and whisker plots on the current advisory message unit.
10.1 Program Text
Program Text (g01asfe.f90)
10.2 Program Data
Program Data (g01asfe.d)
10.3 Program Results
Program Results (g01asfe.r)