Plots credible intervals for the observed data under the posterior predictive distribution, and for a specific observation type. The user can control the levels of the intervals and the plotted group(s). This is a generic function.
# S3 method for epimodel
posterior_sample_size(object)# S3 method for epimodel
all_obs_types(object)
plot_linpred(object, ...)
# S3 method for epimodel
plot_linpred(
object,
type = NULL,
groups = NULL,
dates = NULL,
date_breaks = "2 weeks",
date_format = "%Y-%m-%d",
levels = c(30, 60, 90),
...
)
A fitted model object returned by epim
.
See epimodel-objects
.
Additional arguments for
posterior_predict.epimodel
. Examples include
newdata
, which allows
predictions or counterfactuals.
the name of the observations to plot. This should match one
of the names of the obs
argument to epim
.
Either NULL
or a character vector specifying the groups
to plot for. Default is NULL
, which plots all modeled groups.
A length 2 vector of Date
objects. This defines the
start and end dates of the date-range to be plotted. Must be coercible to
Date
if not NA
. If an element of the vector is NA
then
the default lower/upper limit is used. See examples.
A string giving the distance between date tick labels.
Default is "2 weeks"
. This is passed as the date_breaks
argument to
scale_x_date
. Please see here for details.
This function attempts to coerce the dates
argument
to a vector of Date
objects. date_format
is passed as the format
argument to as.Date
. Default is "%Y-%m-%d".
A numeric vector defining the levels of the plotted credible intervals.
A ggplot
object which can be further modified.