EFT_clust: EFT_clust

View source: R/09_EFTs_custering.R

EFT_clustR Documentation

EFT_clust

Description

EFT_clust derives the Ecosystem Functional Types using K-means to perform a clustering on the pixels of the SpatRaster object

Usage

EFT_clust(
  obj2clust = NULL,
  n_clust = 20,
  standardise_vars = TRUE,
  filename = "",
  ...
)

Arguments

obj2clust

SpatRaster object (or its file name). Each layer is one variable

n_clust

Numeric. Number of total clusters. Optional. Default = 20

standardise_vars

Logical. Optional. If TRUE (default), variables are standardised (mean = 0; sd = 1)

filename

Character. Output filename. Optional

...

Arguments for kmeans. Optional

Details

kmeans does not optimize the final number of clusters. It needs to be set by means of 'n_clust' (default = 20). There are several methods and statistics to determine the optimal number. clust_optim produces a scree plot to help the user to decide the optimal number of clusters.

EFT_clust passes as default to kmeans iter.max = 500 and algorithm = "MacQueen", but these can be modified passing these arguments through '...'

Please note that the variables are standardised (mean = 0; sd = 1) before running the clustering

An evaluation of the clustering is provided together with the SpatRaster object. It is calculated as model$betweenss / model$totss * 100; where 'betweenss' and 'totss' are generated by kmeans

Value

A list with two components: (1) a SpatRaster object with the clusters and (2) a vector with the clustering evaluation in percentage

Author(s)

Xavier Rotllan-Puig

See Also

PCAs4clust; clust_optim; kmeans

Examples


dirctry <- paste0(system.file(package='LPDynR'), "/extdata")
variables_noCor <- rm_multicol(dir2process = dirctry,
                               multicol_cutoff = 0.7)
EFT_clust(obj2clust = variables_noCor,
         n_clust = 10)


LPDynR documentation built on Oct. 16, 2023, 5:06 p.m.