brms (version 0.5.0)

prior_samples: Extract prior samples

Description

Extract prior samples of specified parameters

Usage

prior_samples(x, parameters = NA, ...)

Arguments

x
An R object typically of class brmsfit
parameters
Name of parameters for which prior samples should be returned, as given by a character vector or regular expressions. By default, all prior samples are extracted
...
Currently ignored

Value

  • A data frame containing the prior samples.

Details

To make use of this function, the model must contain samples of prior distributions. This can be ensured by setting sample.prior = TRUE in function brm. Currently there are methods for brmsfit objects.

Examples

Run this code
fit_i <- 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 samples
samples1 <- prior_samples(fit_i)
head(samples1)

#extract prior samples for the fixed effect of \code{treat}.
samples2 <- posterior_samples(fit_i, "b_treat")
head(samples2)

Run the code above in your browser using DataLab