Description Usage Arguments Examples
Constructs horizontal line plot showing 95 intervals, otherwise known as a caterpillar plot, for the column-specific regression coefficients corresponding to the covariates in X fitted in the boral model. Median coefficient values are shown as a point on each interval.
1 2 3 4 5 6 7 8 | gg_coefsplot(
model,
X.labels = NULL,
linesize = 1.5,
pointsize = 3,
palette = "Greys",
single.colour = "black"
)
|
model |
A boral model fitted with one or more latent variables. |
X.labels |
An optional vector of text strings to use as labels
for the X variables (graph facet labels).
If a named vector is provided (safest), the names will
be used to match labels to the X variable names in the fitted model.
If |
linesize |
Thickness of the line segments drawn for intervals (passed
to ggplot as the |
pointsize |
Size of points representing median values (passed to
ggplot as the |
palette |
The name of the colour palette to use when colouring intervals
to indicating where intervals lie in relation to zero. This should be one
of the sequential palettes recognized by |
single.colour |
The name or hex code of a single colour to use for all
intervals. This argument only applies if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # This example is based on that for the coefsplot function
# in the boral package and requires an example dataset from the
# mvabund package.
library(boral)
library(ggboral)
data(spider, package = "mvabund")
y <- spider$abun
X <- scale( spider$x )
# Warning - these settings are only to make the example run quickly.
# Don't use them for a real analysis!
example.control <- list(n.burnin = 10, n.iteration = 100, n.thin = 1)
spiderfit_nb <- boral(y, X = X,
family = "negative.binomial",
lv.control = list(num.lv = 2),
mcmc.control = example.control)
gg_coefsplot(spiderfit_nb)
# Display plot again with a white background
last_plot() + theme_bw()
# Re-do plot using a different palette for the intervals
# (see help page for ggplot2::scale_colour_distiller for the
# available palette names)
#
gg_coefsplot(spiderfit_nb, palette = "Blues") +
theme_bw()
# Draw all intervals with a single colour
# (the palette argument must be set to NULL otherwise
# it overrides the single.colour argument)
#
gg_coefsplot(spiderfit_nb, palette = NULL, single.colour = "darkred") +
theme_bw()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.