PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_plot_box_whisker (g01as)
Purpose
nag_stat_plot_box_whisker (g01as) produces a specified number of box and whisker plots on a character printing device, with a chosen number of character positions in each direction.
Syntax
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
prt was made optional (default 'P'); output parameters were reordered |
Description
nag_stat_plot_box_whisker (g01as) 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 arguments
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
nag_file_set_unit_advisory (x04ab).
An axis corresponding to the axis is drawn and annotated and data points are plotted to the nearest character position.
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:
– int64int32nag_int array
-
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 .
- 2:
– double array
-
ldx, the first dimension of the array, must satisfy the constraint
.
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
.
- 3:
– int64int32nag_int scalar
-
The number of character positions to be plotted in the -direction.
Constraint:
.
- 4:
– int64int32nag_int scalar
-
The number of character positions to be plotted in the -direction.
Constraint:
.
Optional Input Parameters
- 1:
– string (length ≥ 1)
Default:
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 nag_file_set_unit_advisory (x04ab).
Constraint:
or .
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
n and the second dimension of the array
x. (An error is raised if these dimensions are not equal.)
, the number of data batches that are to be represented.
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
- 2:
– cell array of strings
-
Contains the box and whisker plots.
- 3:
– double array
-
, for , contains the five-point summary of the th batch.
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
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.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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.
Further Comments
The time taken by nag_stat_plot_box_whisker (g01as) increases with and , for .
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.
Open in the MATLAB editor:
g01as_example
function g01as_example
fprintf('g01as example results\n\n');
n = int64([ 5; 6; 8; 8; 7]);
x = [ -9, -5.6, -9, 12, -5;
-7.3, 12, 12, 10, 8;
-4.9, -9, -6, 10, 1.5;
-2.4, -3.9, -3, 8, -3.2;
-0.6, -2.4, 0, 6, -3.2;
0, -7.3, 3, 4, 6.2;
0, 0, 6, 4, 6.2;
0, 0, 9, -9, 0];
nstepx = int64(55);
nstepy = int64(21);
[ifail, plot, work] = g01as( ...
n, x, nstepx, nstepy);
g01as example results
0.1E+02+ --- --- ---
: : : :
: : : -----
0.8E+01+ : : : :
: : ----- : : ---
: : : : :---: :
: : : : : : -----
0.4E+01+ : : : : : : :
: : : : ----- : :
: : : : : : :
: : :---: : :---:
: : : : : : :
-0.6E+00+ --- : : : : : :
: : : : : : : :
: ----- ----- : : : -----
: : : : : : : : :
-0.5E+01+ :---: :---: ----- : ---
: : : : : : :
: ----- ----- : :
: : : : :
-0.9E+01+ --- --- --- ---
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015