Several methods are defined for instances of the class
outbreaker_chains
, returned by outbreaker
, including:
print
, plot
# S3 method for outbreaker_chains
print(x, n_row = 3, n_col = 8, type = "chain", ...)# S3 method for outbreaker_chains
plot(
x,
y = "post",
type = c("trace", "hist", "density", "cluster", "alpha", "t_inf", "kappa", "network"),
burnin = 0,
min_support = 0.1,
labels = NULL,
group_cluster = NULL,
...
)
# S3 method for outbreaker_chains
summary(object, burnin = 0, group_cluster = NULL, ...)
The form of the value returned by plot
depends on the type
.
If the type is set as network
, plot returns a visNetwork object
containing the details of the inferred transmission trees. Otherwise, it
returns a ggplot object containing the elements of the plot.
The function summary
returns a list containing 9 elements:
step
: contains the first and last values of the iteration
number; the interval between each iteration retained for the output
(defined by the parameter sample_every
in create_config
),
and the number of iterations in the output,
post
: contains the minimum, maximum, mean, median and
quartiles of the posterior distribution.
like
: contains the minimum, maximum, mean, median and
quartiles of the likelihood distribution.
prior
: contains the minimum, maximum, mean, median and
quartiles of the prior distribution.
pi
: contains the minimum, maximum, mean, median and quartiles
of the conditional report ratio.
a
: contains the minimum, maximum, mean, median and quartiles
of the spatial parameter a
.
b
: contains the minimum, maximum, mean, median and quartiles
of the spatial parameter b
.
tree
: a data.frame
that contains the most likely
infector, the infection date, and the number of missing generations of each
case. It also contains the support
of the most likely branch (i.e.
the proportion of iterations where the infector of a case is its most
likely infector), and import
, the proportion of iteration where the
case was classified as an importation.
cluster
: a data frame listing the minimum, maximum, median,
mean and quartile of the cluster size distribution.
an outbreaker_chains
object as returned by outbreaker
.
the number of rows to display in head and tail; defaults to 3.
the number of columns to display; defaults to 8.
a character string indicating the kind of plot to be used (see details)
further arguments to be passed to other methods
a character string indicating which element of an
outbreaker_chains
object to plot
the number of iterations to be discarded as burnin
a number between 0 and 1 indicating the minimum support of ancestries to be plotted; only used if 'type' is 'network'
a vector of length N indicating the case labels (must be provided in the same order used for dates of symptom onset)
a numeric vector
indicating the breaks to
aggregate the cluster size distribution.
an outbreaker_chains
object as returned by outbreaker
.
Initial version by Thibaut Jombart, rewritten by Alexis Robert (alexis.robert@lshtm.ac.uk)
type
indicates the type of graphic to plot:
trace
to visualise MCMC traces for parameters or augmented data (plots the
log-likelihood by default)
hist
to plot histograms of quantitative values
density
to plot kernel density estimations of quantitative values
alpha
to visualise the posterior frequency of ancestries
network
to visualise the transmission tree; note that
this opens up an interactive plot and requires a web browser with
Javascript enabled; the argument `min_support` is useful to select only the
most supported ancestries and avoid displaying too many links
kappa
to visualise the distributions generations between cases and their
ancestor/infector
cluster
to visualise the cluster size distribution, grouped by
the value in group_cluster