View source: R/loglik_niche_math_ip_weighted_integrated.R
| loglik_niche_math_ip_weighted_integrated | R Documentation |
Low-level C++ bridge for the inverse-probability-weighted (IPW) normal
niche model. Computes KDE weights and Mahalanobis distances entirely
in C++ to minimise R overhead. This is the workhorse called by
loglik_niche_math_ip_weighted.
loglik_niche_math_ip_weighted_integrated(
theta,
env_occ,
env_m,
eta = 1,
neg = TRUE,
den_idx = NULL,
kde_idx = NULL,
precomp_w_den = NULL
)
theta |
Numeric vector of unconstrained parameters (math scale):
|
env_occ |
Data frame or matrix ( |
env_m |
Data frame or matrix ( |
eta |
Numeric scalar, shape parameter for the LKJ C-vine prior on the correlation matrix (default 1 = uniform over correlations). |
neg |
Logical. If |
den_idx |
Integer vector of 1-based row indices for the denominator
subsample. If |
kde_idx |
Integer vector of 1-based row indices for the KDE reference
subsample. If |
precomp_w_den |
Numeric vector of precomputed KDE weights for the
denominator points (must match |
The objective function is described in detail in
loglik_niche_math_ip_weighted.
This function was formerly called
loglik_niche_math_kde_bias_corrected_integrated.
Scalar numeric: the (negative) log-likelihood.
[loglik_niche_math_ip_weighted()] for the user-facing wrapper with automatic subsampling.
theta <- start_theta(example_env_occ_2d)
ll <- loglik_niche_math_ip_weighted_integrated(
theta = theta,
env_occ = example_env_occ_2d,
env_m = example_env_m_2d,
eta = 1,
neg = TRUE
)
print(ll)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.