Skip to contents

Each model is a point; by default x = MAE and y = AUC, the comparison of Konowalik & Nosol (2021), but any two metrics can be shown. Axes are oriented so that better models are towards the top-right ("lower is better" axes are reversed). The dashed line connects the models on the Pareto front. With a bootstrapped evaluation, bars show the confidence intervals and the fill shows p_pareto, the share of resamples in which the model was on the front.

Usage

plot_pareto(
  x,
  x_metric = NULL,
  y_metric = NULL,
  labels = NULL,
  error_bars = TRUE,
  zoom = FALSE,
  bar_colour = "#c8553d",
  base_size = 12,
  file = NULL,
  width = 2100,
  height = 1500
)

# S3 method for class 'enm_evaluation'
plot(
  x,
  y,
  x_metric = NULL,
  y_metric = NULL,
  zoom = "auto",
  ...,
  file = NULL,
  width = 4200,
  height = 1650
)

Arguments

x

An enm_evaluation object from evaluate_models().

x_metric, y_metric

Metrics (columns of x) for the axes. Default: the second and first criterion (MAE and AUC for the default criteria).

labels

Which models to label: "all", "front" (Pareto models only) or "none". Default: all when there are 15 models or fewer, otherwise front only.

error_bars

Show error bars: bootstrap intervals (<metric>_lower, <metric>_upper) or, if there are none, +/- 1 SD (<metric>_sd), for whichever metrics are on the axes.

zoom

TRUE zooms onto the region of the best models (see plot_selection()); or a list with the axis limits, list(x = c(0.19, 0.24), y = c(0.89, 0.93)). Models outside are named in the subtitle.

bar_colour

Colour of the error bars.

base_size

Base font size passed to ggplot2::theme_minimal().

file

Optional file(s) to save the plot to, e.g. "fig.pdf" or c("fig.png", "fig.pdf"); the format follows the extension, and a name without extension is saved as PNG and PDF. The plot is also returned.

width, height

Size of the saved figure in pixels (PDF and SVG at 300 pixels per inch).

y

Ignored.

...

Passed to plot_pareto().

Value

A ggplot object that can be customised further or saved with ggplot2::ggsave().

Details

By default the axes are the first two criteria used in evaluate_models(). If more than two criteria were used, the front was computed on all of them, so front models may look dominated in a 2-D plot and no front line is drawn.

Examples

sim <- simulate_enm_data(seed = 1)
res <- evaluate_models(sim$models, sim$presence, sim$absence,
                       n_boot = 100, seed = 1)
plot_pareto(res)

plot_pareto(res, x_metric = "TSS")   # any other metric on an axis

# ggplot2::ggsave("pareto.png", plot_pareto(res), width = 7, height = 5,
#                 dpi = 300)