| compare_xnicher | R Documentation |
Builds a one-row-per-model summary table for a list of "xnicher"
fits, including log-likelihood, parameter count, AIC, BIC, deltas
relative to the best model, and Akaike weights.
compare_xnicher(
...,
sort_by = c("AIC", "BIC", "loglik"),
comparison_basis = c("unpenalised", "penalised")
)
... |
Two or more |
sort_by |
Character. One of |
comparison_basis |
Character, one of
|
All fits MUST have been produced from the same env_occ; any
mismatch in nobs or in the variable-name ordering raises an
error, since IC values are not comparable across heterogeneous data.
A data.frame with one row per fit and columns:
modelName (or call index) of the fit.
likelihoodLikelihood family (x$likelihood).
loglikUn-penalised log-likelihood at convergence.
dfNumber of free parameters.
nobsSample size (occurrences).
AIC, BICInformation criteria.
dAIC, dBICDeltas vs. the minimum.
weight_AICAkaike weights, \exp(-\Delta_i / 2) /
\sum_j \exp(-\Delta_j / 2).
convergenceucminfcpp convergence code.
AIC and BIC compare *likelihoods* on the SAME observed data. When
comparing weighted vs. presence-only families, both families evaluate
\log L on n_{occ} occurrences; the weighted family
additionally normalises by an env_m integral, so its
likelihood is on a different scale. In this implementation,
logLik(weighted) returns the full weighted-likelihood value
(occurrence sum minus log-denominator), which is the right thing
for **within-family** comparison (e.g., weighted vs.
skew_normal_weighted) but should be interpreted with care
when contrasting weighted with presence-only.
fit_w <- optimize_niche(example_env_occ_2d, example_env_m_2d,
num_starts = 5L, likelihood = "weighted")
fit_skn <- optimize_niche(example_env_occ_2d, example_env_m_2d,
num_starts = 5L, likelihood = "skew_normal_weighted")
compare_xnicher(weighted = fit_w, skew_normal = fit_skn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.