posterior_smooths.brmsfit {brms} | 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, nsamples = NULL, subset = 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. |
nsamples |
Positive integer indicating how many posterior samples should
be used. If |
subset |
A numeric vector specifying the posterior samples to be used.
If |
... |
Currently ignored. |
An S x N matrix, where S is the number of posterior samples 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)