tabulate_eval: Make a table of a metric for each pair of models and methods

View source: R/tables.R

tabulate_evalR Documentation

Make a table of a metric for each pair of models and methods

Description

Each row of the table corresponds to a different model and each column to a different method. The metric must be a scalar. The way in which standard error is shown (or not shown) is controlled by se_format.

Usage

tabulate_eval(
  object,
  metric_name,
  method_names = NULL,
  caption = NULL,
  center_aggregator = NULL,
  spread_aggregator = NULL,
  se_format = c("Paren", "PlusMinus", "None"),
  output_type = "latex",
  format_args = list(nsmall = 0, digits = NULL, scientific = FALSE),
  na_string = "--",
  bold = c("None", "Smallest", "Largest")
)

Arguments

object

an object of class Simulation, Evals, or listofEvals. Each evals object should just differ by model_name.

metric_name

the name of a metric to tabulate. Must be scalar valued.

method_names

character vector indicating methods to include in table. If NULL, then will include all methods found in object's evals.

caption

caption of plot. If NULL, then default caption used; if FALSE then no caption (and returns tabular without table).

center_aggregator

When NULL (which is default), the sample mean aggregator is used. User can write specialized aggregators (see definition of class Aggregator) as necessary, for example, when the evaluated metric is not scalar-valued.

spread_aggregator

When NULL (which is default), the standard error of the sample mean is used. User can write specialized aggregators (see definition of class Aggregator) as necessary, for example, when the evaluated metric is not scalar-valued. Set spread_aggregator to NA to hide error bars.

se_format

format of the standard error

output_type

see kable's argument format for options. Default is "latex" but other options include "html" and "markdown"

format_args

arguments to pass to the function format

na_string

what to write in table in place of NA

bold

puts in bold the value that is smallest/largest for each model

Details

Uses knitr's function kable to put table in various formats, including latex, html, markdown, etc.

Examples

## Not run: 
 # 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 = list(10, 20, 30),
                  vary_along = "n") %>%
   simulate_from_model(nsim = 50, index = 1:3) %>%
   run_method(my_example_method) %>%
   evaluate(my_example_loss)
   # then we could plot this
   tabulate_eval(sim, "myloss")
 
## End(Not run)

simulator documentation built on Feb. 16, 2023, 9:34 p.m.