Visualize Model Assessment Metrics Across Time
Source:R/plot_model_assessment.R
plot_model_assessment.RdGenerates diagnostic plots from the per-timestep assessment table produced
by generate_spatiotemporal_predictions, optionally overlaying
overall reference values from the model result object.
Usage
plot_model_assessment(predictions, time_column,
secondary_time_mode = "combine", model_result = NULL,
cbp_threshold = 0.05, plot_palette = "Dark 2",
verbose = TRUE)Arguments
- predictions
List returned by
generate_spatiotemporal_predictions, or a named list with at least atimestep_metricselement. Thetimestep_metricselement may also be a path to aTimestep_Assessment_Metrics.csvfile produced bygenerate_spatiotemporal_predictions.- time_column
Character. Name of the primary time column in
timestep_metricsto use as the x axis (e.g."year"). When predictions span multiple time columns (e.g."year"and"season"), provide all relevant column names as a character vector and control how secondary columns are handled viasecondary_time_mode.- secondary_time_mode
Character. How to handle secondary time columns when
time_columnhas length > 1. One of:"combine"(default): secondary time values are appended to the primary value to form a single ordered x-axis label (e.g.1_Spring,1_Summer,2_Spring, ...)."facet": a separate plot is produced for each unique combination of secondary time values, with the primary time column as the x axis on every panel.
- model_result
List or character. Optional. Output from a
build_temporal_*()function or path to its.rdsfile. When supplied, overall sensitivity and specificity frommodel_result$fold_test_metricsare added as per-fold reference lines. Default isNULL.- cbp_threshold
Numeric. Significance threshold for CBP. Default is
0.05.- plot_palette
Character. Name of an HCL or RColorBrewer palette used to color folds in diagnostic plots. Accepts any HCL palette name (see
hcl.pals) or, if RColorBrewer is installed, any Brewer palette name. Default is"Dark 2".- verbose
Logical. If
TRUE(default), prints progress messages during processing.
Value
Invisibly returns a named list containing:
pct_suitable: Recorded plot of proportion of study area predicted suitable per time step.sensitivity: Recorded plot of per-timestep sensitivity.specificity: Recorded plot of per-timestep specificity (only present when pseudoabsence data were used).cbp: Recorded plot of cumulative binomial probability per time step on a log scale.tp_fn: Recorded plot of true positives and false negatives per time step.tn_fp: Recorded plot of true negatives and false positives per time step (only present when pseudoabsence data were used).timestep_summary: Data frame of per-time-step cross-fold mean and SD for each metric.overall_summary: Data frame frompredictions$overall_summary, when present.
Details
Plots per-fold and per-timestep diagnostic plots for data produced by
generate_spatiotemporal_predictions. These quick visuals can
be used by users to assess model performance and significance and decide
if the model's performance warrants further interpretation of the results
through post-processing analyses.
See also
Preprocessing: spatiotemporal_partition,
generate_absences
Modeling: build_temporal_glm, build_temporal_gam,
build_temporal_rf, build_temporal_hv,
Post-processing: generate_spatiotemporal_predictions,
summarize_raster_outputs





