mapclust_cut_tree {SPARTAAS} | R Documentation |
Function to cut the dendrogram for a new height (distance limit) or a new number of clusters and map the new partition
Description
The function returns the new map, one dendrogram with the cut line, the silhouette width and the new vector cluster. You must call mapclust beforehand to get a mapclust_cl
object that can be used by mapclust_cut_tree.
Usage
mapclust_cut_tree(classification, nb_grp = NA, dlim = NA)
Arguments
classification |
The object return by mapclust |
nb_grp |
The number of groups you want to have on the partition. Must be an integer. (don't use dlim in this case) |
dlim |
The value of dlim at which you wish to cut the dendrogram. You can enter any value (numerical) and the function will select the nearest lower dlim with the same partition. (do not use nb_grp in this case). |
Value
the function returns a list.
Plot:
dendrogram |
The global dendrogram (hclust object) |
dendrogram_ggplot |
The global dendrogram (ggplot2 object) |
cuttree |
The cut dendrogram |
map |
The map of the selected partition |
AveSilPlot |
The average silhouette width plot (for each partition) |
WSSPlot |
The Within Sum of Square plot (for each partition) |
silhouette |
The silhouette plot of the selected partition |
Value:
X |
The x-coordinate data you have used |
Y |
The y-coordinate data you have used |
var |
The regionalised variable data you have used |
label |
The label vector you have used |
density |
The estimated density based on var. Equal to var if you used a unidimensional density variable |
cluster |
The cluster vector of the selected partition |
Plabel |
Logical parameter to activate or not the printing of labels on the dendrogram |
fullhist |
The compositional cluster for each observation |
hist |
The compositional cluster without duplicates (corresponds to the split on the dendogram) |
dlim |
The vector of the different limit distances |
cutdlim |
The select dlim for the cut of the current partition |
DiMatrix |
The weighted euclidean distance matrix |
silhouetteData |
The silhouette data of the selected partition |
AveSilData |
The average silhouette value for each partition |
Moran |
The Moran index for each group for each partition |
lonlat |
Logical parameter, whether your coordinates are in latitude-longitude format or not |
Author(s)
A. COULON L. BELLANGER P. HUSI
Examples
## loading data
library(SPARTAAS)
data(datarcheo)
##First you need to run the mapclust function.
#This function allow you to obtain one partition
# object <- mapclust( coord = ..., var = ..., label = ...)
OldClassif <- mapclust(datarcheo$coord, datarcheo$var, datarcheo$label, n = 4)
##In order to cut the dendrogram for another dlim
NewCut <- mapclust_cut_tree(classification = OldClassif, dlim = 0.37)
##In order to cut the dendrogram for another number of cluster
NewCut2 <- mapclust_cut_tree(classification = OldClassif, nb_grp = 4)
#See evaluation using Silhouette width by running:
NewCut$silhouette
#If the plot is empty try to increase the height of the window (full screen).
#See summary of the data by running:
summary(NewCut$silhouetteData)