ps_regions {phylospatial} | R Documentation |
Cluster analysis to identify phylogenetic regions
Description
Perform a clustering analysis that categorizes sites into biogeographic regions based on phylogenetic community compositional similarity.
Usage
ps_regions(ps, k = 5, method = "average", endemism = FALSE, normalize = TRUE)
Arguments
ps |
A |
k |
Number of spatial clusters to divide the region into (positive integer). See ps_regions_eval to help choose a value of k by comparing the variance explained by different numbers of regions. |
method |
Clustering method. Options include all methods listed under hclust, and |
endemism |
Logical indicating whether community values should be divided by column totals (taxon range sizes)
to derive endemism. Only used if |
normalize |
Logical indicating whether community values should be divided by row totals (community sums). If |
Value
A raster or matrix with an integer indicating which of the k
regions each site belongs to.
References
Daru, B. H., Elliott, T. L., Park, D. S., & Davies, T. J. (2017). Understanding the processes underpinning patterns of phylogenetic regionalization. Trends in Ecology & Evolution, 32(11), 845-860.
Examples
ps <- ps_simulate()
# using kmeans clustering algorithm
terra::plot(ps_regions(ps, method = "kmeans"))
# to use a hierarchical clustering method, first we have to `ps_add_dissim()`
terra::plot(ps_regions(ps_add_dissim(ps), k = 7, method = "average"))