View source: R/Lib_MapBetaDiversity.R
ordination_to_NN | R Documentation |
compute_NMDS <- function(MatBCdist,dimMDS=3) nbiterNMDS <- 4 if (Sys.info()["sysname"] == "Windows") nbCoresNMDS <- 2 else if (Sys.info()["sysname"] == "Linux") nbCoresNMDS <- 4 # multiprocess of spectral species distribution and alpha diversity metrics # plan(multisession, workers = nbCoresNMDS) ## Parallelize using four cores plan(multisession, workers = nbCoresNMDS) ## Parallelize using four cores BetaNMDS <- future_lapply(MatBCdist, FUN = nmds, mindim = dimMDS, maxdim = dimMDS, nits = 1, future.packages = c("ecodist")) plan(sequential) # find iteration with minimum stress Stress <- vector(length = nbiterNMDS) for (i in 1:nbiterNMDS) Stress[i] <- BetaNMDS[[i]]$stress print("Stress obtained for NMDS iterations:") print(Stress) print("Rule of thumb") print("stress < 0.05 provides an excellent represention in reduced dimensions") print("stress < 0.1 is great") print("stress < 0.2 is good") print("stress > 0.3 provides a poor representation") MinStress <- find(Stress == min(Stress)) BetaNMDS_sel <- BetaNMDS[[MinStress]]$conf BetaNMDS_sel <- data.frame(BetaNMDS_sel[[1]]) return(BetaNMDS_sel) Identifies ordination coordinates based on nearest neighbors
ordination_to_NN(
SSD_subset,
Beta_Ordination_sel,
Sample_Sel,
nb_partitions,
nbclusters,
pcelim = 0.02,
nbCPU = 1,
SamplesPerThread = 2000,
progressbar = FALSE
)
SSD_subset |
numeric. matrix corresponding to Spectral species distribution for a set of windows |
Beta_Ordination_sel |
ordination of dissimilarity matrix for a selection of spatial units |
Sample_Sel |
numeric. Samples selected during ordination |
nb_partitions |
number of k-means then averaged |
nbclusters |
number of clusters |
pcelim |
numeric. Minimum contribution in percent required for a spectral species |
nbCPU |
numeric. number of CPUs available |
SamplesPerThread |
numeric. number of samples to be processed per thread for dissimilarity matrix |
progressbar |
boolean. should progress bar be displayed (set to TRUE only if no conflict of parallel process) |
Ordination_est coordinates of each spatial unit in ordination space
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.