Skip to contents

Convenience helper for teaching and method testing.

spesim_method_test() runs a simulation, computes a lightweight audit of the realised regime (via spesim_audit()), and optionally returns a small set of standard analysis tables and plots.

Compared to spesim_demo(), this helper is oriented toward auditing and comparing settings (e.g., sampling schemes) rather than a curated "basic → advanced" teaching progression.

Usage

spesim_method_test(
  init_file = NULL,
  P = NULL,
  seed = NULL,
  write_outputs = FALSE,
  output_prefix = NULL,
  diagnostics = "nn",
  make_tables = TRUE,
  make_plots = TRUE,
  ...
)

Arguments

init_file

Optional path to an init file. If NULL, uses the packaged example examples/spesim_init_basic.txt.

P

Optional parameter list as returned by load_config(). If supplied, it takes precedence over init_file.

seed

Optional integer seed. If provided, overrides any seed in P. If NULL, the helper uses P$SEED when available (so results are reproducible).

write_outputs

Logical. Passed to spesim_run(). Default FALSE (fast; no files written).

output_prefix

Optional output prefix passed to spesim_run(). Only used when write_outputs = TRUE.

diagnostics

Diagnostics to compute in spesim_audit(). Default "nn" for deterministic, dependency-minimal behaviour.

make_tables

Logical; if TRUE, include standard analysis tables.

make_plots

Logical; if TRUE, include standard plots.

...

Additional arguments passed to spesim_run().

Value

A list with elements:

  • res: spesim_result returned by spesim_run().

  • audit: audit list returned by spesim_audit().

  • tables (optional): named list of analysis tables (when make_tables = TRUE).

  • plots (optional): named list of plots (when make_plots = TRUE).

Examples

if (FALSE) { # \dontrun{
x <- spesim_method_test(make_plots = TRUE)
x$audit
x$plots$spatial
} # }