View source: R/posterior_samples.R
posterior_samples.brmsfit | R Documentation |
Extract posterior samples of specified parameters. The
posterior_samples
method is deprecated. We recommend using the more
modern and consistent as_draws_*
extractor
functions of the posterior package instead.
## S3 method for class 'brmsfit'
posterior_samples(
x,
pars = NA,
fixed = FALSE,
add_chain = FALSE,
subset = NULL,
as.matrix = FALSE,
as.array = FALSE,
...
)
posterior_samples(x, pars = NA, ...)
x |
An |
pars |
Names of parameters for which posterior samples should be returned, as given by a character vector or regular expressions. By default, all posterior samples of all parameters are extracted. |
fixed |
Indicates whether parameter names
should be matched exactly ( |
add_chain |
A flag indicating if the returned |
subset |
A numeric vector indicating the rows
(i.e., posterior samples) to be returned.
If |
as.matrix |
Should the output be a |
as.array |
Should the output be an |
... |
Arguments passed to individual methods (if applicable). |
A data.frame (matrix or array) containing the posterior samples.
as_draws
,
as.data.frame
## Not run:
fit <- brm(rating ~ treat + period + carry + (1|subject),
data = inhaler, family = "cumulative")
# extract posterior samples of population-level effects
samples1 <- posterior_samples(fit, pars = "^b")
head(samples1)
# extract posterior samples of group-level standard deviations
samples2 <- posterior_samples(fit, pars = "^sd_")
head(samples2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.