er_vpc_add_observed: Add the observed-data layer to a VPC plot

View source: R/er-vpc-add.R

er_vpc_add_observedR Documentation

Add the observed-data layer to a VPC plot

Description

Bins the observed data for a VPC plot and computes binned response summaries for later comparison against a simulated data layer.

Usage

er_vpc_add_observed(object, style = er_style_vpc_observed_mean_errorbar, ...)

Arguments

object

Partially constructed VPC (has S3 class er_vpc).

style

Style used to draw the VPC observed data layer. Can either be a string corresponding to one of the registered style labels (e.g., "mean_errorbar", the default), or a builder function used to compute the relevant plot object (see "Styles" below).

...

Additional named arguments forwarded to the style builder function when the plot is built.

Details

plot_by/n_bins/conf_level/probs are set once on er_vpc() itself (rather than here) so the observed and simulated layers can't disagree about how the comparison is binned or summarized.

Value

object, with object$layer$observed populated.

Styles

The following pre-defined styles are available for this layer. Please see the documentation for the corresponding builder function to see what customisation options are available:

Label Builder Description
"mean_errorbar" er_style_vpc_observed_mean_errorbar() Mean/rate + CI per bin, x-position adaptive to plot_by's type (the default).
"quantile_line" er_style_vpc_observed_quantile_line() One line per requested percentile against a continuous plot_by axis.
"quantile_errorbar" er_style_vpc_observed_quantile_errorbar() Point + error bar per bin and per requested percentile.

See er_style_vpc() for details on how style builder functions are defined for the VPC mini-grammar, should a custom style be required.

See Also

er_vpc(), er_vpc_add_simulated(), er_style_vpc_observed()


erplots documentation built on Oct. 4, 2026, 5:06 p.m.