View source: R/betaStability.R
| betaStability | R Documentation |
This function integrates various prediction methods (linear, multiple linear, generalized linear model, generalized additive model, generalized dissimilarity model, random forest, and xgboost) to calculate the stability of each site.
betaStability(
comtable = NULL,
envmeta = NULL,
comdist = NULL,
envdist = NULL,
sitenames = NULL,
method = "linearPred",
X = NULL,
Y = NULL,
geo_enabled = TRUE,
GAM.dist.method = "manhattan",
vegdist.method = "bray",
xgboost.params = NULL,
seed = 42
)
comtable |
The community table (required). |
envmeta |
The environmental metadata table/matrix (required). |
comdist |
The community dissimilarity matrix (optional). If not provided, computed from comtable using vegdist(). |
envdist |
The environmental dissimilarity matrix (optional). If not provided, computed from envmeta using euclidean distance on range-normalized envmeta. |
sitenames |
The names of the site (optional, default: NULL) |
method |
A character string or vector specifying the prediction method(s) to use. Available options: "linearPred", "mlPred", "glmPred", "gamPred", "gdmPred", "rfPred", "xgboostPred". Use "all" to run all methods. Default is "linearPred". |
X |
The X coordinates of the sites for gdmPred (optional, default: NULL) |
Y |
The Y coordinates of the sites for gdmPred (optional, default: NULL) |
geo_enabled |
Whether to include geographic info for gdmPred (default: TRUE) |
GAM.dist.method |
The method for calculating dist for gamPred (default: "manhattan") |
vegdist.method |
The method for calculating comdist from comtable (default: "bray") |
xgboost.params |
A list of parameters for the xgboost model (default: NULL). If NULL, default parameters will be used. |
seed |
The random seed for reproducibility of rfPred and xgboostPred (default: 42) |
If method = "all", returns a data frame with 7 columns, each representing results from each selected method. If method length is 1, returns a column vector of predicted stability values. If method length > 1, returns a data frame with each column representing results from each selected method.
library(vegan)
data(varespec)
data(varechem)
# Single method (linearPred)
result_linear <- betaStability(
comtable = varespec,
envmeta = varechem,
method = "linearPred"
)
# Multiple methods
results_multi <- betaStability(
comtable = varespec,
envmeta = varechem,
method = c("linearPred", "mlPred")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.