clusterGrid: Cluster analysis

View source: R/clusterGrid.R

clusterGridR Documentation

Cluster analysis

Description

Cluster analysis of climate data. Several clustering algorithms are available.

Usage

clusterGrid(
  grid,
  type = "kmeans",
  centers = NULL,
  newdata = NULL,
  y = NULL,
  ...
)

Arguments

grid

A grid (gridded or station dataset), multigrid, multimember grid or multimember multigrid object

type

Clustering algorithm. Possible values are "kmeans" (default), "hierarchical", "som" and "lamb". See Details.

centers

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

newdata

Optional grid containing the data for prediction. It must contain the same variables as the input grid taken as reference.

y

Optional predictand grid data. Clustering Analysis of this grid will be performed as a day-by-day correspondence with the reference grid (grid or newdata). Thus time dimension from y and the reference grid must intersect. For weather typing.

...

Further specific arguments passed to the different clustering functions.

Details

kmeans

While using the K-means algorithm, the number of clusters (argument centers) needs to be provided (with no default). See the kmeans documentation for further details and optional arguments of the method.

hierarchical

While using the hierarchical algorithm (check hclust for further information) clusterGrid allows the user either to especify a predefined 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 interquartile range of the heights vector, as determined by 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). By default, a rectangular topology (8x6) of 48 clusters is obtained.

Lamb

The Lamb Weather Typing algorithm (Lamb 1972) is implemented in the function lambWT. The argument centers is not used. A default of 26 types is calculated, following Trigo and daCamara (2000)

Value

A C4R (multimember/multi) grid object that will contain the data from:

  • The input grid, if neither newdata nor y are indicated.

  • The newdata grid if this is specified, and y = NULL.

  • The y grid, if this is specified.

The clustering type (cluster.type), number of clusters (centers), centroids of clusters from 'grid' input (centroids) and the days corresponding to each cluster (index) are returned as attributes in all clustering algorithms. Then, other algorithm-specific parameters are provided as attributes.

Author(s)

J. A. Fernández

References

Lamb, H., 1972. British Isles weather types and a register of the daily sequence of circulation patterns.

Trigo, R.M., DaCamara, C.C., 2000. Circulation weather types and their influence on the precipitation regime in Portugal. Int. J. Climatol. 23. https://doi.org/10.1002/1097-0088(20001115)20:13

See Also

kmeans, hclust, som.

Examples


require(climate4R.datasets)
#Example of K-means clustering: 
data(NCEP_Iberia_psl)
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 lamb clustering:
data(NCEP_slp_2001_2010)
clusters <- clusterGrid(grid = NCEP_slp_2001_2010, type = "lamb")


SantanderMetGroup/transformeR documentation built on Nov. 25, 2024, 1:25 p.m.