View source: R/predict_xnicher.R
| predict.xnicher | R Documentation |
xnicher objectpredict method for objects of class "xnicher" returned
by optimize_niche. Reconstructs the niche centroid
\mu and covariance \Sigma from the optimizer's
best$theta (mu, log_sigma, v) parameterization, then evaluates
the standardized Gaussian suitability map of Jimenez et al. (2022,
Eq. 2) over an environmental SpatRaster.
## S3 method for class 'xnicher'
predict(
object,
env,
...,
return_log = FALSE,
threads = RcppParallel::defaultNumThreads(),
output = "",
overwrite = FALSE,
wopt = list()
)
object |
A |
env |
A multi-layer |
... |
Currently ignored. |
return_log |
Logical. |
threads |
Integer. Threads for the inner C++ kernel. Default
|
output |
Character. File path for the output GeoTIFF. The
empty string |
overwrite |
Logical. Forwarded to |
wopt |
List. Forwarded to |
The same Gaussian suitability surface is used for every fitted family:
"weighted", "ip_weighted", "presence_only",
and the skew-normal / skew-t variants all project the fitted
(\mu, \Sigma) geometry. For skew fits, the skewness and tail
parameters affect fitting but are not used by this Gaussian projection.
Internally:
\mu = \theta_{1:p}.
\sigma = \exp(\theta_{p+1:2p}).
C-vine partial-correlation block
v = \theta_{2p+1:\,length(\theta)} is mapped to a
correlation Cholesky factor via
cvine_cholesky.
L = \mathrm{diag}(\sigma)\, L_{corr},
\Sigma = L L^\top.
A one-layer SpatRaster named "suitability"
(or "log_suitability"). Returned invisibly when
output is non-empty.
habitat_suitability,
niche_suitability_cpp,
cvine_cholesky.
fit <- optimize_niche(
env_occ = example_env_occ_2d,
env_m = example_env_m_2d,
num_starts = 5L,
likelihood = "weighted"
)
r1 <- terra::rast(nrows = 10, ncols = 10)
r2 <- terra::rast(nrows = 10, ncols = 10)
terra::values(r1) <- rnorm(100)
terra::values(r2) <- rnorm(100)
env <- c(r1, r2)
names(env) <- colnames(example_env_occ_2d)
suit <- predict(fit, env)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.