View source: R/helpers-prior.R
| default_prior.bmmformula | R Documentation |
Obtain the default priors for a Bayesian multilevel measurement
model, as well as information for which parameters priors can be specified.
Given the model, the data and the formula for the model, this
function will return the default priors that would be used to estimate the
model. Additionally, it will return all model parameters that have no prior
specified (flat priors). This can help to get an idea about which priors
need to be specified and also know which priors were used if no
user-specified priors were passed to the bmm() function.
The default priors in bmm tend to be more informative than the default
priors in brms, as we use domain knowledge to specify the priors.
Each model parameter carries three default priors, listed in the
documentation of the model: main for the intercept (or for all levels of
a factor when the intercept is suppressed), effects for the remaining
regression coefficients, and sd for the standard deviations of its random
effects. The sd prior is applied as a blanket prior to every random-effects
standard deviation of that parameter (all grouping factors, intercepts and
slopes alike) and replaces the student_t(3, 0, 2.5) default of brms. To
override it, address the parameter with dpar or nlpar in
brms::set_prior(), e.g. set_prior("exponential(2)", class = "sd", nlpar = "kappa").
Correlations among random effects belong to a grouping factor rather than to
one parameter, so they get a single default for the whole model: lkj(2)
instead of the lkj(1) of brms, set whenever the model estimates a
correlation matrix. To override it, use e.g. set_prior("lkj(1)", class = "cor").
## S3 method for class 'bmmformula'
default_prior(object, data, model, formula = object, ...)
object |
A |
data |
An object of class data.frame, containing data of all variables
used in the model. The names of the variables must match the variable names
passed to the |
model |
A description of the model to be fitted. This is a call to a
|
formula |
An object of class |
... |
Further arguments passed to |
A data.frame with columns specifying the prior, the class, the
coef and group for each of the priors specified. Separate rows contain
the information on the parameters (or parameter classes) for which priors
can be specified.
bmm_models(), brms::default_prior()
default_prior(bmf(c ~ 1, kappa ~ 1),
data = oberauer_lin_2017,
model = sdm(resp_error = "dev_rad")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.