plot.bru | R Documentation |
bru()
uses INLA::inla()
to fit models. The latter estimates the posterior densities of
all random effects in the model. This function serves to access and plot the posterior
densities in a convenient way.
Requires the ggplot2
package.
## S3 method for class 'bru'
plot(x, ...)
x |
a fitted |
... |
A character naming the effect to plot, e.g. "Intercept". For random
effects, adding |
an object of class gg
## Not run:
if (require("ggplot2", quietly = TRUE)) {
# Generate some data and fit a simple model
input.df <- data.frame(x = cos(1:10))
input.df <- within(input.df, y <- 5 + 2 * cos(1:10) + rnorm(10, mean = 0, sd = 0.1))
fit <- bru(y ~ x, family = "gaussian", data = input.df)
summary(fit)
# Plot the posterior of the model's x-effect
plot(fit, "x")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.