prior_draws.brmsfit | R Documentation |
Extract prior draws of specified parameters
## S3 method for class 'brmsfit' prior_draws(x, variable = NULL, pars = NULL, ...) prior_draws(x, ...) prior_samples(x, ...)
x |
An |
variable |
A character vector providing the variables to extract. By default, all variables are extracted. |
pars |
Deprecated alias of |
... |
Arguments passed to individual methods (if applicable). |
To make use of this function, the model must contain draws of
prior distributions. This can be ensured by setting sample_prior =
TRUE
in function brm
. Priors of certain parameters cannot be saved
for technical reasons. For instance, this is the case for the
population-level intercept, which is only computed after fitting the model
by default. If you want to treat the intercept as part of all the other
regression coefficients, so that sampling from its prior becomes possible,
use ... ~ 0 + Intercept + ...
in the formulas.
A data.frame
containing the prior draws.
## Not run: fit <- brm(rating ~ treat + period + carry + (1|subject), data = inhaler, family = "cumulative", prior = set_prior("normal(0,2)", class = "b"), sample_prior = TRUE) # extract all prior draws draws1 <- prior_draws(fit) head(draws1) # extract prior draws for the coefficient of 'treat' draws2 <- prior_draws(fit, "b_treat") head(draws2) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.