| runSA | R Documentation |
Estimate species interaction parameters and (optionally) environmental
preference parameters by stochastic approximation (SA). The function runs
multiple SA optimizations in parallel (when threads > 1) using
foreach.
runSA(
ocmat,
enmat = NULL,
rep = 128,
threads = 1,
we = 0.001,
totalit = 1000,
lambda = 0.01,
intv = 100,
runadamW = TRUE,
maxlr = 0.005,
sparse = TRUE,
getall = FALSE,
reporting = TRUE
)
ocmat |
Numeric matrix (0/1). Rows are samples and columns are species. |
enmat |
Optional numeric matrix. Environmental variables for each sample. Should be normalized/standardized beforehand. |
rep |
Integer. Number of parallel runs (replicates) for optimization. |
threads |
Integer. Number of cores used when running in parallel. |
we |
Numeric. Weight decay parameter for AdamW. |
totalit |
Integer. Total number of optimization iterations. |
lambda |
Numeric. Sparsity penalty parameter (used when |
intv |
Integer. Interval of iterations at which intermediate results are recorded. |
runadamW |
Logical. If |
maxlr |
Numeric. Maximum learning rate. |
sparse |
Logical. If |
getall |
Logical. If |
reporting |
Logical. If |
If getall = TRUE, a list of SA trajectories (length rep).
Otherwise, a list with two elements, c(params, enmat) is returned.
params is the concatenated matrix of the estimated parameter set:
Implicit environmental effects on species occurrence
Species-species interaction matrix
(If enmat is not NULL) Explicit effects of the environmental factors.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.