Plot residual outlier bands as stacked bars
Source:R/plot_validation.R
plot_validation_residual_bands.RdSummarises absolute flow-comparison differences into residual standard-deviation or quantile bands and plots the share of OD pairs in each band. The default comparison is adjusted versus benchmark.
Usage
plot_validation_residual_bands(
residuals,
method_col = "method",
method_labels = NULL,
comparisons = "adjusted_vs_benchmark",
methods = NULL,
band_method = c("sd", "quantile"),
sd_reference = c("selected", "adjusted", "pooled"),
quantile_reference = c("selected", "adjusted", "pooled"),
quantile_probs = c(0.5, 0.75, 0.9, 0.95),
palette = NULL,
label_min_share = 8,
orientation = c("horizontal", "vertical")
)
plot_validate_flow_residual_heatmap(...)Arguments
- residuals
A data frame, one
validate_flow_residuals()result, or a named list ofvalidate_flow_residuals()results.- method_col
Column containing the method identifier. Default
"method".- method_labels
Optional named character vector used to relabel methods.
- comparisons
Flow comparison(s) to plot. Defaults to
"adjusted_vs_benchmark". Use"all"to facet all supported comparisons. When"raw_vs_benchmark"is included, it is shown once as the unadjusted raw MPD baseline.- methods
Optional character vector of method identifiers or display labels to include. Default
NULLincludes all methods.- band_method
Banding strategy.
"sd"uses standard-deviation bands;"quantile"uses shared absolute-residual quantile cut points. Default"sd".- sd_reference
Standard-deviation reference.
"selected"uses the selected comparison residuals,"adjusted"uses the pooled benchmark-minus-adjusted residuals, and"pooled"uses all three canonical comparison residuals. Used whenband_method = "sd".- quantile_reference
Quantile reference.
"selected"uses the selected comparison residuals,"adjusted"uses pooled benchmark-minus-adjusted absolute residuals, and"pooled"uses all three canonical comparison residuals. Used whenband_method = "quantile".- quantile_probs
Interior quantile cut points used when
band_method = "quantile". Defaultc(0.5, 0.75, 0.9, 0.95).- palette
Optional named or unnamed character vector of colours. Defaults to a colour-blind-aware sequential palette ordered from lower to higher residual-severity bands.
Minimum segment share, in percentage points, required for an in-bar label. Default
8.- orientation
Bar orientation.
"horizontal"places methods on the y-axis and shares on the x-axis;"vertical"keeps methods on the x-axis. Default"horizontal".