Skip to contents

brms's as.brmsprior(). A data frame (or anything as.data.frame() accepts) with a prior column becomes the object set_prior() returns, one specification per row. Missing columns take set_prior()'s defaults (class = "b", empty coef, group, resp, dpar and nlpar, no bounds) and columns set_prior() does not take are dropped.

Usage

as.brmsprior(x)

Arguments

x

A data frame with a prior column, a brmsprior, a default_prior() table or a frmtmb_priorlist.

Value

A frmtmb_priorlist.

Details

The name is brms's, and so is the job: turn a table into the prior object this package fits with. That object is a frmtmb_priorlist rather than a brmsprior, because this package parses a density when it is written rather than when the model is compiled. A brmsprior built by brms is translated row by row, as frm() translates one, and a table from default_prior() or validate_prior() is read as written.

A row whose prior is empty or "(flat)" and that carries no bound is brms's (flat) on its slot, set_prior("", ...): frm() applies nothing there, and frmtmb.sample::frm_sample() reads it as (flat) in place of its default, as brms does. A row whose source is "(vectorized)", which repeats the density of the class row above it, is left out.

Examples

as.brmsprior(data.frame(prior = "normal(0,1)", coef = c("a", "b")))
#>        prior class coef group resp dpar nlpar   lb   ub source
#>  normal(0,1)     b    a                       <NA> <NA>   user
#>  normal(0,1)     b    b                       <NA> <NA>   user