plot_marginals: Plot marginals

Description Usage Arguments Details

Description

Plots the marginal effects for continuous viewpoints in a viewpoint regression model, as extracted by get_marginal.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_marginals(
  model_1,
  model_2 = NULL,
  model_labels = NULL,
  x_lab = "Feature value",
  y_lab = "Effect",
  viewpoint_labels = model_1$viewpoint_labels,
  fill = "blue",
  alpha = 0.25,
  scales = "free",
  ...
)

Arguments

model_1

Viewpoint regression model, as created by viewpoint_regression.

model_2

Optional second viewpoint regression model, to be plotted for comparison.

model_labels

Only relevant if a second viewpoint regression model is provided, in which case this should be a character vector of length 2 corresponding to the plot labels for these two models.

x_lab

(Character scalar) Label for the x axis.

y_lab

(Character scalar) Label for the y axis.

viewpoint_labels

tibble of viewpoint labels.

fill

(Character scalar) Fill colour for the shaded region identifying the 5th-95th percentiles of observed feature values.

alpha

(Numeric scalar) Alpha value for the shaded region.

scales

Passed to facet_wrap.

...

Further arguments to pass to facet_wrap.

Details

The x axis spans the 5th-95th percentiles of theoretically possible feature values as computed in the derivation of the model matrix (see compute_model_matrix). The shaded area identifies the 5th-95th percentiles of observed feature values when computing the model matrix.


pmcharrison/hvr documentation built on April 14, 2020, 2:47 a.m.