md_check | R Documentation |
Evaluates whether the cumulative mean of a tracked error metric in simulation outputs has stabilized, indicating convergence. This function helps determine if repeated simulations or resampling have produced stable estimates, which is critical for reliable inference in animal movement projects.
Use this function after running md_run()
or
md_replicate()
to check the reliability of outputs
before further interpretation or reporting.
md_check(
obj,
m = NULL,
tol = 0.05,
n_converge = 10,
plot = TRUE,
pal = c("#007d80", "#A12C3B")
)
obj |
A |
m |
Numeric (optional). If provided, restricts the convergence
check to results for a specific population sample size ( |
tol |
Numeric. The tolerance threshold for absolute change in
the cumulative mean to declare convergence. Defaults to
|
n_converge |
Integer. Number of consecutive steps within
tolerance required to confirm convergence. Defaults to |
plot |
Logical. If |
pal |
Character vector of color(s) of the plot, such as
|
The cumulative mean of error is calculated, and the absolute changes
over the last n_converge
steps are inspected. If all are
below the specified tolerance, convergence is declared.
If plot = TRUE
, a plot is shown of absolute stepwise change
in the cumulative mean, with a shaded region indicating the
convergence threshold, aiding visual assessment.
An object of class "movedesign_check"
with the
following elements:
has_converged
Logical scalar indicating whether convergence was achieved.
recent_deltas
Numeric vector of absolute changes in cumulative mean
over the last n_converge
steps.
max_delta
Maximum absolute change among the last steps.
tolerance
Numeric, the input tolerance tol
.
n_converge
Integer, the input n_converge
.
Character. Name of the variable checked.
Numeric vector. The last cumulative means checked.
md_run()
,
md_replicate()
if(interactive()) {
# After running a simulation or resampling:
md_check(output, tol = 0.05, n_converge = 10)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.