clusterGrid: Cluster analysis of grids

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Performs cluster analysis of grids, multigrids or multimember multigrids. Several clustering algorithms are available.

Usage

1
2
clusterGrid(grid, type = "kmeans", centers = NULL, iter.max = 10,
  nstart = 1, method = "complete")

Arguments

grid

A grid (gridded or station dataset), multigrid, multimember grid or multimember multigrid object, as returned e.g. by loadeR::loadGridData (or loadeR::loadStationData), a multigrid, as returned by makeMultiGrid, or other types of multimember grids (possibly multimember grids) as returned e.g. by loadeR.ECOMS::loadECOMS.

type

Clustering algorithm to be used for the cluster analysis. Possible values are "kmeans" (default), "hierarchical", "som". The core functions are kmeans, hclust, som, respectively. See Details.

centers

Integer value indicating the number of clusters, k, or center points. See Details.

iter.max

(for the K-means algorithm) Integer value indicating the maximum number of iterations allowed. Default: 10.

nstart

(for the K-means algorithm) If centers is a number, how many random sets should be chosen? Default: 1.

method

(for the hierarchical algorithm) Agglomeration method to be used, one of "complete" (default), "ward.D", "ward.D2", "single", "average", "mcquitty", "median" or "centroid".

Details

kmeans

While using the K-means algorithm, the number of clusters (argument 'centers') needs to be provided (no default). See kmeans for more details in the implementation.

hierarchical

While using the hierarchical algorithm (check hclust for further information) clusterGrid allows the user either to especify the number of clusters ('centers') or not. If the argument 'centers' is not provided, they are automatically set and the tree is cut when the height difference between two consecutive divisions (sorted in ascending order) is larger than the intercuartile range of the heights vector (see cutree) .

som

While using the SOM (self-organizing maps) algorithm (check som for further information), the argument 'centers' is provided as a two-element vector, indicating the dimensions xdim,ydim of the grid (see somgrid). Otherwise, by default 48 clusters (8x6) with rectangular topology are obtained.

Value

A new C4R grid object that contains the clusters created using the specified algorithm. Clusters are included in the dimension 'time'. The clustering type, number of clusters and other algorithm-specific parameters are provided as attributes.

Author(s)

J. A. Fernandez

See Also

kmeans, hclust, som.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Example of K-means clustering: 
data(NCEP_Iberia_psl, package = "transformeR")
clusters<- clusterGrid(NCEP_Iberia_psl, type="kmeans", centers=10, iter.max=1000)

#Example of hierarchical clustering: 
clusters<- clusterGrid(NCEP_Iberia_psl, type="hierarchical")

#Example of som clustering: 
clusters<- clusterGrid(NCEP_Iberia_psl, type="som", centers = c(10,1))

#Example of K-means clustering of several variables:
data(NCEP_Iberia_ta850, package = "transformeR")
clusters<- clusterGrid(makeMultiGrid(NCEP_Iberia_psl, NCEP_Iberia_ta850), type="kmeans", centers=10, iter.max=1000)

juanferngran/test documentation built on June 29, 2020, 3:11 a.m.