View source: R/posterior_smooths.R
posterior_smooths.brmsfit | R Documentation |
Compute posterior predictions of smooth s
and t2
terms of
models fitted with brms.
## S3 method for class 'brmsfit'
posterior_smooths(
object,
smooth,
newdata = NULL,
resp = NULL,
dpar = NULL,
nlpar = NULL,
ndraws = NULL,
draw_ids = NULL,
...
)
posterior_smooths(object, ...)
object |
An object of class |
smooth |
Name of a single smooth term for which predictions should be computed. |
newdata |
An optional |
resp |
Optional names of response variables. If specified, predictions are performed only for the specified response variables. |
dpar |
Optional name of a predicted distributional parameter. If specified, expected predictions of this parameters are returned. |
nlpar |
Optional name of a predicted non-linear parameter. If specified, expected predictions of this parameters are returned. |
ndraws |
Positive integer indicating how many posterior draws should
be used. If |
draw_ids |
An integer vector specifying the posterior draws to be used.
If |
... |
Currently ignored. |
An S x N matrix, where S is the number of posterior draws and N is the number of observations.
## Not run:
set.seed(0)
dat <- mgcv::gamSim(1, n = 200, scale = 2)
fit <- brm(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)
summary(fit)
newdata <- data.frame(x2 = seq(0, 1, 10))
str(posterior_smooths(fit, smooth = "s(x2)", newdata = newdata))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.