Provides an interface to the MCMC module in the bayesplot package, and allows seamless plotting of MCMC draws along with various diagnostics. This method relies heavily on the code base for the plot.stanreg method in rstanarm.

# S3 method for epimodel
plot(
  x,
  plotfun = "intervals",
  pars = NULL,
  regex_pars = NULL,
  par_models = NULL,
  par_types = c("fixed", "aux", "seeds"),
  par_groups = NULL,
  ...
)

Arguments

x

A fitted model object returned by epim. See epimodel-objects.

plotfun

Same as in plot.stanreg. A character string giving the name of the bayesplot MCMC function to use. These can be listed using available_mcmc. Defaults to "interval"

pars

A character vector giving parameter names.

regex_pars

A character vector of regular expressions to select parameters. If pars is also used, regex_pars is used in conjunction with pars.

par_models

A character vector that restricts parameters to a subset of model components. For example, "R" only uses parameters in the transmission model, "inf" uses parameters in infection model. Strings giving the name of the response in an observation model (i.e. LHS of the formula in epiobs) can also be used. If NULL (the default), all components are used.

par_types

A character vector that restricts parameters based on their type. The vector can include any of "fixed", "autocor", "random", "aux", "latent", or "seeds". The default is c("fixed", "aux", "seeds"), to avoid printing a very large number of parameters. If NULL, all types are used.

par_groups

A character vector restricting parameters to those used for a subset of regions in which the epidemic is modeled. Defaults to NULL in which case all regions are used.

...

Arguments passed on to the bayesplot function specified by plotfun.

Value

Either a ggplot object that can be further customized using the ggplot2 package, or an object created from multiple ggplot objects (e.g. a gtable object created by arrangeGrob).

See also