Description Usage Arguments Details Value See Also Examples
View source: R/variance_plots.R
Plots estimates of the proportion of variance in each response accounted for
by explanatory variables, latent variables and any row effects, as estimated
by the boral function calc.varpart
.
1 | gg_varpart(model, as.percent = FALSE, label.means = FALSE)
|
model |
A boral model fitted with one or more latent variables. |
as.percent |
If |
label.means |
If |
Proceed with caution! Read the caveats and warnings detailed in the help page
for calc.varpart
when interpreting the plot drawn by this function.
Also keep in mind that the results can be influenced by data artefacts, e.g.
when modelling species occurrence data with a binomial model, the estimate
of variance explained by predictor variables will tend to be higher for species
with few presences than for more common species.
A ggplot object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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)
# Note that we specify save.model = TRUE when calling boral
#
spiderfit_nb <- boral(y, X,
family = "negative.binomial",
lv.control = list(num.lv = 2),
row.eff = "fixed",
mcmc.control = example.control,
save.model = TRUE)
gg_varpart(spiderfit_nb,
as.percent = TRUE,
label.means = TRUE) + theme_bw()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.