Similar to ggplot2, vmc uses + to allows you to start simple, then get more and more complex, checking your work at each step.

# S3 method for modelcheck
+(e1, e2)

Arguments

e1

An object of class modelcheck.

e2

A model check component, as described below.

what can you add?

You can add any of the following types of objects:

  • An mc_draw() object overrides the current model distribution

  • A uncertainty representation layer created by mc_model_ or mc_obs_ functions adds a visual layer for model distribution or observed data.

  • A comparative layout layer created by mc_layout_ functions overrides the current comparative layout.

  • A mc_condition_on() object overrides the current conditional variables on x axis, rows, or columns.

  • A mc_gglayer() object adds a ggplot layer to the ggplot object generated by vmc.

  • A color object overrides the color/fill of model distribution and observed data in model check.

You can also supply a list, in which case each element of the list will be added in turn.

Examples

library(ggplot2)

mcplot(mpg_model) +
  mc_draw("mu") +
  mc_condition_on(x = vars(disp))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.


# Alternatively, you can add multiple components with a list.
# This can be useful to return from a function.
mcplot(mpg_model) +
  list(mc_draw("mu"),
       mc_condition_on(x = vars(disp)))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.