brms (version 0.10.0)

get_prior: Overview on Priors for brms Models

Description

Get information on all parameters (and parameter classes) for which priors may be specified including default priors.

Usage

get_prior(formula, data = NULL, family = gaussian(), autocor = NULL, nonlinear = NULL, partial = NULL, threshold = c("flexible", "equidistant"), internal = FALSE)

Arguments

formula
An object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.
data
An optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which brm is called. Although it is optional, we strongly recommend to supply a data.frame.
family
A description of the error distribution and link function to be used in the model. This can be a family function, a call to a family function or a character string naming the family. Currently, the following families are supported: gaussian, student, cauchy (deprecated), binomial, bernoulli, Beta, poisson, negbinomial, geometric, Gamma, lognormal, inverse.gaussian, exponential, weibull, categorical, cumulative, cratio, sratio, acat, hurdle_poisson, hurdle_negbinomial, hurdle_gamma, zero_inflated_binomial, zero_inflated_beta, zero_inflated_negbinomial, and zero_inflated_poisson. Every family function has a link argument allowing to specify the link function to be applied on the response variable. If not specified, default links are used. See family for help on standard family functions and brmsfamily for family functions specific to the brms package. For backwards compatibility, family may also be a vector of two character strings, the first naming the family and the second naming the link. Further information is provided under 'Details'.
autocor
An optional cor_brms object describing the correlation structure within the response variable (i.e. the 'autocorrelation'). See the documentation of cor_brms for a description of the available correlation structures. Defaults to NULL, corresponding to no correlations.
nonlinear
An optional list of formuluas, specifying linear models for non-linear parameters. If NULL (the default) formula is treated as an ordinary formula. If not NULL, formula is treated as a non-linear model and nonlinear should contain a formula for each non-linear parameter, which has the parameter on the left hand side and its linear predictor on the right hand side. Alternatively, it can be a single formula with all non-linear parameters on the left hand side (separated by a +) and a common linear predictor on the right hand side. More information is given under 'Details'.
partial
(Deprecated) A one sided formula of the form ~expression allowing to specify predictors with category specific effects in non-cumulative ordinal models (i.e. in families cratio, sratio, or acat). As of brms > 0.8.0 category specific effects should be specified directly within formula using function cse.
threshold
A character string indicating the type of thresholds (i.e. intercepts) used in an ordinal model. "flexible" provides the standard unstructured thresholds and "equidistant" restricts the distance between consecutive thresholds to the same value.
internal
A flag indicating if the names of additional internal parameters should be displayed. Setting priors on these parameters is not recommended

Value

A data.frame with columns prior, class, coef, and group and several rows, each providing information on a parameter (or parameter class) on which priors can be specified. The prior column is empty except for internal default priors.

See Also

set_prior

Examples

Run this code
## get all parameters and parameters classes to define priors on
(prior <- get_prior(count ~ log_Age_c + log_Base4_c * Trt_c
                    + (1|patient) + (1|visit),
                    data = epilepsy, family = poisson()))   
         
## define a prior on all population-level effects a once
prior$prior[1] <- "normal(0,10)"

## define a specific prior on the population-level effect of Trt_c
prior$prior[5] <- "student_t(10, 0, 5)"       

## verify that the priors indeed found their way into Stan's model code
make_stancode(count ~ log_Age_c + log_Base4_c * Trt_c 
              + (1|patient) + (1|visit),
              data = epilepsy, family = poisson(), 
              prior = prior)

Run the code above in your browser using DataLab