| er_vpc_add_simulated | R Documentation |
Bins the simulation data for a VPC plot and computes binned response summaries for comparison against the observed data layer.
er_vpc_add_simulated(
object,
model = NULL,
sim = NULL,
style = er_style_vpc_simulated_mean_errorbar,
nsim = 100,
seed = NULL,
simulate_args = list(),
...
)
object |
Partially constructed VPC (has S3 class |
model |
A fitted model implementing |
sim |
Simulated data with matching exposure/response/ |
style |
Style used to draw the VPC simulation layer. Can
either be a string corresponding to one of the registered style labels
(e.g., |
nsim |
Number of simulation replicates, only used with |
seed |
Optional RNG seed. Used for |
simulate_args |
A named list of additional arguments forwarded to
|
... |
Additional named arguments forwarded to the |
sim and model are mutually exclusive; supply exactly one. model
is preferred when it implements er_simulate() with sim_resp,
since a VPC needs response-level simulated observations rather than
only mean predictions – this function errors informatively if
sim_resp isn't available.
conf_level/probs are set once on er_vpc() itself (rather than
here), so the observed and simulated layers always agree on them.
object, with object$layer$simulated populated.
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_simulated_mean_errorbar() | Mean/rate + CI per bin, x-position adaptive to plot_by's type (the default). |
"quantile_ribbon" | er_style_vpc_simulated_quantile_ribbon() | One ribbon per requested percentile against a continuous plot_by axis. |
"quantile_errorbar" | er_style_vpc_simulated_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.
er_vpc(), er_vpc_add_observed(), er_style_vpc_simulated()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.