|
NAG[g03ejc] NAG[nag_mv_cluster_indicator] - Construct clusters following g03ecc (nag_mv_hierar_cluster_analysis)
|
|
Calling Sequence
g03ejc(cd, iord, dord, k, dlevel, ic, 'n'=n, 'fail'=fail)
nag_mv_cluster_indicator(. . .)
Parameters
|
cd - Vector(1.., datatype=float[8]);
|
|
|
Constraint: , for . .
|
|
|
iord - Vector(1..n, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
|
dord - Vector(1..n, datatype=float[8]);
|
|
|
On entry: the clustering distances corresponding to the order in iord.
|
|
|
k - assignable;
|
|
|
Note: On exit the variable k will have a value of type integer.
|
|
On entry: indicates if a specified number of clusters is required.
|
|
nag_mv_cluster_indicator (g03ejc) will attempt to find k clusters.
|
|
nag_mv_cluster_indicator (g03ejc) will find the clusters based on the distance given in dlevel.
|
|
Constraint: . .
|
|
On exit: the number of clusters produced, .
|
|
|
dlevel - assignable;
|
|
|
Note: On exit the variable dlevel will have a value of type float.
|
|
On entry: if , then dlevel must contain the distance at which clusters are produced. Otherwise dlevel need not be set.
|
|
Constraint: if , . .
|
|
On exit: if on entry, then dlevel contains the distance at which the required number of clusters are found. Otherwise dlevel remains unchanged.
|
|
|
ic - Vector(1..n, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
|
'n'=n - integer; (optional)
|
|
|
Default value: the first dimension of the arrays iord, dord, ic.
|
|
On entry: the number of objects, .
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Description
|
|
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 g03ecc (nag_mv_hierar_cluster_analysis)), 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. nag_mv_cluster_indicator (g03ejc) takes the information from the tree and produces the clusters that exist at a given distance. This is equivalent to taking the dendrogram (see g03ehc (nag_mv_dendrogram)) and drawing a line across at a given distance to produce clusters.
As an alternative to giving the distance at which clusters are required, the user can specify the number of clusters required and nag_mv_cluster_indicator (g03ejc) 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 1 and to each object to indicate to which cluster it belongs. Object 1 always belongs to cluster 1.
|
|
Error Indicators and Warnings
|
|
"NE_2_INT_ARG_GT"
On entry, while . These arguments must satisfy .
"NE_CLUSTER"
The precise number of clusters requested is not possible because of tied clustering distances. The actual number of clusters produced is .
"NE_INCOMP_ARRAYS"
Arrays cd and dord are not compatible.
"NE_INT_ARG_LT"
On entry, n must not be less than 2: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_NOT_INCREASING"
The sequence cd is not increasing: , .
"NE_REAL_INT"
On entry, , . Constraint: and .
"NW_2_INT"
On exit, , . Trivial solution returned.
"NW_INT"
On exit, . Trivial solution returned.
"NW_REAL_REALARR"
On entry, , . Trivial solution returned.
|
|
|
Examples
|
|
>
|
n := 5:
k := 2:
dlevel := 0:
cd := Vector([1, 2, 6.5, 14.125], datatype=float[8]):
iord := Vector([1, 3, 5, 2, 4], datatype=integer[kernelopts('wordsize')/8]):
dord := Vector([2, 6.5, 14.125, 1, 14.125], datatype=float[8]):
ic := Vector(5, datatype=integer[kernelopts('wordsize')/8]):
NAG:-g03ejc(cd, iord, dord, k, dlevel, ic, 'n' = n):
|
|
|