Draw samples from the posterior distribution of an estimated model
Draw samples from the posterior distribution of an estimated model
posterior_samples(model, ...) ## S3 method for class 'gam' posterior_samples( model, n, newdata, seed, scale = c("response", "linear_predictor"), freq = FALSE, unconditional = FALSE, weights = NULL, ncores = 1L, ... )
model |
a fitted model of the supported types |
... |
arguments passed to other methods. For |
n |
numeric; the number of posterior samples to return. |
newdata |
data frame; new observations at which the posterior draws
from the model should be evaluated. If not supplied, the data used to fit
the model will be used for |
seed |
numeric; a random seed for the simulations. |
scale |
character; |
freq |
logical; |
unconditional |
logical; if |
weights |
numeric; a vector of prior weights. If |
ncores |
number of cores for generating random variables from a
multivariate normal distribution. Passed to |
A tibble (data frame) with 3 columns containing the posterior predicted values in long format. The columns are
row
(integer) the row of newdata
that each posterior draw relates to,
draw
(integer) an index, in range 1:n
, indicating which draw each row
relates to,
response
(numeric) the predicted response for the indicated row of
newdata
.
Gavin L. Simpson
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.