brms (version 0.5.0)

posterior_samples: Extract posterior samples

Description

Extract posterior samples of specified parameters

Usage

posterior_samples(x, parameters = NA, exact_match = FALSE,
  add_chains = FALSE, ...)

Arguments

x
An R object typically of class brmsfit
parameters
Name 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
exact_match
Indicates whether parameter names should be matched exactly or treated as regular expression. Default is FALSE.
add_chains
A flag indicating if the returned data.frame should contain information on the chains
...
Currently ignored

Value

  • A data frame containing the posterior samples, with one column per parameter.

Details

Currently there are methods for brmsfit objects.

Examples

Run this code
fit_i <- brm(rating ~ treat + period + carry + (1|subject),
             data = inhaler, family = "cumulative")

#extract posterior samples of fixed effects
samples1 <- posterior_samples(fit_i, "b_")
head(samples1)

#extract posterior samples of standard deviations of random effects
samples2 <- posterior_samples(fit_i, "sd_")
head(samples2)

Run the code above in your browser using DataLab