erplots draws exposure-response plots from any fitted model that
implements this small interface, rather than assuming a particular model
class (e.g. a logistic regression glm). To make a model usable with
er_plot_show_model() and friends, implement at least a method for
er_predict(). Implementing er_simulate() additionally enables
simulation-based visualisations (e.g. spaghetti plots, VPCs); implementing
er_summary() enables annotations such as p-value labels.
Usage
er_predict(model, newdata, conf_level = 0.95, ...)
er_simulate(model, newdata, nsim = 100, seed = NULL, ...)
er_summary(model, ...)Value
er_predict()returnsnewdatawith three additional columns:fit_resp(point prediction),ci_lower, andci_upper.er_simulate()returns a data frame containingnsimreplicates ofnewdata, with asim_idcolumn identifying each replicate, and afit_respcolumn giving the simulated prediction for that replicate (reflecting parameter uncertainty). Models that cannot support simulation-based visualisation should not implement a method; the default method returnsNULL; callers should treat aNULLresult as "not available" rather than an error.er_summary()returns a named list of scalar summary statistics (for examplelist(p_value = 0.013)), orNULLif nothing is available. The default method returnsNULL.