The routine may be called by the names g03ejf or nagf_mv_cluster_hier_indicator.
Given a distance or dissimilarity matrix for objects, cluster analysis aims to group the objects into a number of more or less homogeneous groups or clusters. With agglomerative clustering methods (see g03ecf), a hierarchical tree is produced by starting with clusters each with a single object and then at each of stages, merging two clusters to form a larger cluster until all objects are in a single cluster. g03ejf takes the information from the tree and produces the clusters that exist at a given distance. This is equivalent to taking the dendrogram (see g03ehf) and drawing a line across at a given distance to produce clusters.
As an alternative to giving the distance at which clusters are required, you can specify the number of clusters required and g03ejf will compute the corresponding distance. However, it may not be possible to compute the number of clusters required due to ties in the distance matrix.
If there are clusters then the indicator variable will assign a value between and to each object to indicate to which cluster it belongs. Object always belongs to cluster .
Everitt B S (1974) Cluster Analysis Heinemann
Krzanowski W J (1990) Principles of Multivariate Analysis Oxford University Press
1: – IntegerInput
On entry: , the number of objects.
2: – Real (Kind=nag_wp) arrayInput
On entry: the clustering distances in increasing order as returned by g03ecf.
, for .
3: – Integer arrayInput
On entry: the objects in dendrogram order as returned by g03ecf.
4: – Real (Kind=nag_wp) arrayInput
On entry: the clustering distances corresponding to the order in iord.
5: – IntegerInput/Output
On entry: indicates if a specified number of clusters is required.
If then g03ejf will find the clusters based on the distance given in dlevel.
On exit: the number of clusters produced, .
6: – Real (Kind=nag_wp)Input/Output
On entry: if , dlevel must contain the distance at which clusters are produced. Otherwise dlevel need not be set.
if , .
On exit: if on entry, dlevel contains the distance at which the required number of clusters are found. Otherwise dlevel remains unchanged.
7: – Integer arrayOutput
On exit: indicates to which of clusters the th object belongs, for .
8: – 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, and .
On entry, and .
On entry, .
On entry the values of cd are not in increasing order.
On entry the values of dord and cd are not compatible.
The precise number of clusters requested is not possible because of tied clustering distances. The actual number of clusters is returned in k.
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.
The accuracy will depend upon the accuracy of the distances in cd and dord (see g03ecf).
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g03ejf is not threaded in any implementation.
A fixed number of clusters can be found using the non-hierarchical method used in g03eff.
Data consisting of three variables on five objects are input. Euclidean squared distances are computed using g03eaf and median clustering performed using g03ecf. A dendrogram is produced by g03ehf and printed. g03ejf finds two clusters and the results are printed.