Skip to contents

When the evaluted metric is scalar-valued, this functions makes a boxplot of this metric for each method. When the metric is vector-valued, this function makes a curve with this metric on the y-axis, with one curve for each method (the x-axis is the corresponding entry of that metric's vector). If evals is a listofEvals, then each model will be its own plot.

Usage

plot_eval(
  object,
  metric_name,
  use_ggplot2 = TRUE,
  main,
  facet_mains,
  ylab,
  ylim,
  include_zero = FALSE,
  angle = 0,
  ...
)

Arguments

object

an object of class Simulation, Evals, or listofEvals

metric_name

the name of a metric to plot

use_ggplot2

whether to use ggplot2 (requires installation of ggplot2)

main

title of plot. Default is model_label when evals is a single Evals.

facet_mains

only to be used when evals is a listofEvals and should be of the same length. Default will be the model_label for each model.

ylab

the y-axis label (default is metric_label)

ylim

the y-axis limits to use (across all plots)

include_zero

whether ylim should include 0. Ignored if ylim is passed explicitly

angle

angle of labels (only when use_ggplot2 = FALSE)

...

additional arguments to pass to boxplot (only when use_ggplot2 = FALSE).

Examples

if (FALSE) {
 # suppose previously we had run the following:
 sim <- new_simulation(name = "normal-example",
                       label = "Normal Mean Estimation",
                       dir = tempdir()) %>%
   generate_model(make_my_example_model, n = 20) %>%
   simulate_from_model(nsim = 50, index = 1:3) %>%
   run_method(my_example_method) %>%
   evaluate(my_example_loss)
   # then we could plot this
   plot_eval(sim, "myloss") # "myloss" is my_example_loss@name
 }