View source: R/xnicher_class.R
| assess.xnicher | R Documentation |
Evaluates the quality of a multi-start optimization by comparing converged solutions. Returns one of four diagnostic flags:
"accepted_global"Multiple starts agree closely on the same high log-likelihood value — the global optimum is likely found.
"accepted_noise"Converged solutions are close but show minor numerical noise — likely a good solution.
"suggest_average"Converged solutions spread across
distinct values — consider averaging theta or increasing
num_starts.
"needs_more_starts"Too few converged solutions to draw
conclusions — increase num_starts.
## S3 method for class 'xnicher'
assess(x, tol_gap = 0.01, tol_dist = 0.05, min_converged = 2L, ...)
x |
A |
tol_gap |
Numeric. Relative tolerance used to decide between
|
tol_dist |
Numeric. Relative tolerance used to decide between
|
min_converged |
Integer. Minimum number of converged solutions
required to avoid |
... |
Ignored. |
A named list with:
flagCharacter scalar, one of the four flags above.
recommendationHuman-readable action recommendation.
gapAbsolute log-likelihood gap between the best and second-best converged solutions.
rel_gapRelative gap (gap / |best_loglik|).
n_convergedNumber of converged solutions.
best_loglikBest log-likelihood value.
result <- optimize_niche(
env_occ = example_env_occ_2d,
env_m = example_env_m_2d,
num_starts = 5L,
likelihood = "ip_weighted"
)
diag <- assess(result)
cat("Flag :", diag$flag, "\n")
cat("Recommendation:", diag$recommendation, "\n")
cat("Best log-lik :", round(diag$best_loglik, 4L), "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.