model_to_priors: Convert model's posteriors to priors (EXPERIMENTAL)

Description Usage Arguments Examples

View source: R/model_to_priors.R

Description

Convert model's posteriors to (normal) priors.

Usage

1
model_to_priors(model, scale_multiply = 3, ...)

Arguments

model

A Bayesian model.

scale_multiply

The SD of the posterior will be multiplied by this amount before being set as a prior to avoid overly narrow priors.

...

Other arguments for insight::get_prior() or describe_posterior.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# brms models
# -----------------------------------------------
if (require("brms")) {
  formula <- brms::brmsformula(mpg ~ wt + cyl, center = FALSE)

  model <- brms::brm(formula, data = mtcars, refresh = 0)
  priors <- model_to_priors(model)
  priors <- brms::validate_prior(priors, formula, data = mtcars)
  priors

  model2 <- brms::brm(formula, data = mtcars, prior = priors, refresh = 0)
}

## End(Not run)

bayestestR documentation built on Sept. 5, 2021, 5:27 p.m.