I would like to use a 'greedy' algorithm that would select sites such as to maximize unrepresented species richness. The first site selected would be the one with the highest richness,while the second would be the one with highest unrepresented (i.e., not already selected) richness and so on. If two sites had the same unrepresented richness, then the site with the most rare species would be selected.
The richness-based greedy algorithm I aim to use could work as follows:
- Select Richness (site with highest number of species not already represented)
- Ties broken by Representation (site supporting species with the lowest total representation among sites)
- Further ties broken by Random.
The input data would be a species abundance matrix (rows = sites, cols = species), and the output a ranked list of sites to select.
Although I have found a range of descriptions for similar greedy algorithms in publications, I have not yet been able to find available software or R packages/code that would do that.
The closest I found is the function 'optim_species' of the package "ausplotsR", which uses a range of diversity metrics to optimize. However, in this function's output I obtain site numbers and how increasing them influences said metric, without getting the identity of each site. Note that the function output includes one ranked list of sites, but does not say for which diversity metric it was calculated.
See the following:
# load package
library(ausplotsR)
# create test matrix
species_matrix <- matrix(
c(1, 0, 1, 1, 0, 0,
0, 0, 1, 0, 0, 0,
0, 1, 1, 0, 0, 0,
0, 1, 0, 0, 1, 0,
0, 0, 0, 0, 0, 1),
nrow = 5,
ncol = 6,
byrow = TRUE,
dimnames = list(c("Site 1", "Site 2", "Site 3", "Site 4", "Site 5"), c("Species 1", "Species 2", "Species 3", "Species 4", "Species 5", "Species 6"))
)
# optim_species' test
optim_species(species_matrix, n.plt = 5, frequent = FALSE)
In this simple example, optim_species provides a list of ranked sites that do maximise richness, but with my dataset (species abundance for 130 species in 18 sites) the ranked sites do not necessarily optimize richness.
Is there a way to obtain the identity of the listed Sites for each diversity metric in this package? Or is there other alternatives that would produce a similar result?