plot.nodesplit_summary {multinma} | R Documentation |
Plots of node-splitting models
Description
Produce summary plots of node-splitting models
Usage
## S3 method for class 'nodesplit_summary'
plot(
x,
...,
pars = "d",
stat = "dens_overlay",
orientation = c("horizontal", "vertical", "y", "x"),
ref_line = NA_real_
)
Arguments
x |
A |
... |
Additional arguments passed on to the underlying |
pars |
Character vector specifying the parameters to include in the
plot, choices include |
stat |
Character string specifying the |
orientation |
Whether the |
ref_line |
Numeric vector of positions for reference lines, by default no reference lines are drawn. |
Details
Plotting is handled by ggplot2 and the stats and geoms provided in
the ggdist package. As a result, the output is very flexible. Any
plotting stats provided by ggdist
may be used, via the argument stat
.
The default "dens_overlay"
is a special exception, which uses
ggplot2::geom_density()
, to plot overlaid
densities. Additional arguments in ...
are passed to the ggdist
stat,
to customise the output.
Alternative stats can be specified to produce different summaries. For
example, specify stat = "[half]eye"
to produce (half) eye plots, or stat = "pointinterval"
to produce point estimates and credible intervals.
A full list of options and examples is found in the ggdist
vignette
vignette("slabinterval", package = "ggdist")
.
A ggplot
object is returned which can be further modified through the
usual ggplot2 functions to add further aesthetics, geoms, themes, etc.
Value
A ggplot
object.
See Also
Examples
# Run smoking node-splitting example if not already available
if (!exists("smk_fit_RE_nodesplit")) example("example_smk_nodesplit", run.donttest = TRUE)
# Summarise the node-splitting results
(smk_nodesplit_summary <- summary(smk_fit_RE_nodesplit))
# Plot the node-splitting results
plot(smk_nodesplit_summary)
# Plot the inconsistency factors instead, change the plot stat to half-eye,
# and add a reference line at 0
plot(smk_nodesplit_summary, pars = "omega", stat = "halfeye", ref_line = 0)
# Plot a comparison of the heterogeneity under the node-split models vs.
# the consistency model
plot(smk_nodesplit_summary, pars = "tau")