Description Usage Arguments Details Value Author(s) See Also Examples
Constructs horizontal line plot (point estimate and HPD intervals), otherwise known as "caterpillar plots", for the column-specific regression coefficients corresponding to a covariate in X
fitted in the model.
1 2 |
covname |
The name of one of the covariates in the fitted model. That is, it must be a character vector corresponding to one of the elements in |
x |
An object for class "boral". |
labely |
Controls the labels on the y-axis for the line plot. If it is not |
est |
A choice of either the posterior median ( |
... |
Additional graphical options to be included in. These include values for |
For each species (column of y
), the horizontal line or "caterpillar" is constructed by first marking the point estimate (posterior mean or median) with an "x" symbol. Then the line is construed based on the lower and upper limits of the highest posterior density (HPD) intervals as found in x$hpdintervals
. By default these intervals of 95% HPD intervals. To complete the plot, a vertical dotted line is drawn to denote the zero value. All HPD intervals that include zero are colored gray, while HPD intervals that exclude zero are colored black.
The graph is probably better explained by, well, plotting it using the toy example below =P
Thanks to Robert O'Hara for suggesting and providing the original code for this function.
If SSVS was applied individually to each coefficient of X
when fitting the model, then the posterior probabilities of including the specified covariate are printed out i.e.,
those from x$ssvs.indcoefs.mean
.
NA
Maintainer: NA
caterplot
from the mcmcplots
package for other, sexier caterpillar plots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
## NOTE: The values below MUST NOT be used in a real application;
## they are only used here to make the examples run quick!!!
example_mcmc_control <- list(n.burnin = 10, n.iteration = 100,
n.thin = 1)
library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
n <- nrow(y)
p <- ncol(y)
X <- scale(spider$x)
spiderfit_nb <- boral(y, X = X, family = "negative.binomial",
lv.control = list(num.lv = 2), mcmc.control = example_mcmc_control)
## Do separate line plots for all the coefficients of X
par(mfrow=c(2,3), mar = c(5,6,1,1))
sapply(colnames(spiderfit_nb$X), coefsplot,
spiderfit_nb)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.