The routine may be called by the names g03ehf or nagf_mv_cluster_hier_dendrogram.
Hierarchical cluster analysis, as performed by g03ecf, can be represented by a tree that shows at which distance the clusters merge. Such a tree is known as a dendrogram. See Everitt (1974) and Krzanowski (1990) for examples of dendrograms. A simple example is,
The end points of the dendrogram represent the objects that have been clustered. They should be in a suitable order as given by g03ecf. Object is always the first object. In the example above the height represents the distance at which the clusters merge.
The dendrogram is produced in
a character array
using the ordering and distances provided by g03ecf. Suitable characters are used to represent parts of the tree.
There are four possible orientations for the dendrogram. The example above has the end points at the bottom of the diagram which will be referred to as south. If the dendrogram was the other way around with the end points at the top of the diagram then the orientation would be north. If the end points are at the left-hand or right-hand side of the diagram the orientation is west or east. Different symbols are used for east/west and north/south orientations.
Everitt B S (1974) Cluster Analysis Heinemann
Krzanowski W J (1990) Principles of Multivariate Analysis Oxford University Press
1: – Character(1)Input
On entry: indicates which orientation the dendrogram is to take.
The end points of the dendrogram are to the north.
The end points of the dendrogram are to the south.
The end points of the dendrogram are to the east.
The end points of the dendrogram are to the west.
, , or .
2: – IntegerInput
On entry: the number of objects in the cluster analysis.
3: – Real (Kind=nag_wp) arrayInput
On entry: the array dord as output by g03ecf. dord contains the distances, in dendrogram order, at which clustering takes place.
, for .
4: – Real (Kind=nag_wp)Input
On entry: the clustering distance at which the dendrogram begins.
5: – Real (Kind=nag_wp)Input
On entry: the distance represented by one symbol of the dendrogram.
6: – IntegerInput
On entry: the number of character positions used in the dendrogram. Hence the clustering distance at which the dendrogram terminates is given by .
7: – Character(*) arrayOutput
Note: the length of each element of c must be at least if or , or at least nsym if or .
On exit: the elements of c contain consecutive lines of the dendrogram.
8: – IntegerInput
On entry: the dimension of the array c as declared in the (sub)program from which g03ehf is called.
if or , ;
if or , .
9: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or 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).
6Error 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, .
On entry, .
On entry, and or .
Constraint: if or , .
On entry, and or . Constraint: if or , .
On entry, .
On entry, .
On entry, .
Constraint: , , or .
On entry, the number of characters that can be stored in each element of c is insufficient for the requested orientation.
On entry, , .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g03ehf is not threaded in any implementation.
The scale of the dendrogram is controlled by dstep. The smaller the value dstep is, the greater the amount of detail that will be given but nsym will have to be larger to give the full dendrogram. The range of distances represented by the dendrogram is dmin to . The values of dmin, dstep and nsym can thus be set so that only part of the dendrogram is produced.
The dendrogram does not include any labelling of the objects. You can print suitable labels using the ordering given by the array iord returned by g03ecf.
Data consisting of three variables on five objects are read in. Euclidean squared distances are computed using g03eaf and median clustering performed by g03ecf. g03ehf is used to produce a dendrogram with orientation east and a dendrogram with orientation south. The two dendrograms are printed.