constant | R Documentation |
Function used to set up constant priors in brms. The function does not evaluate its arguments – it exists purely to help set up the model.
constant(const, broadcast = TRUE)
const |
Numeric value, vector, matrix of values to which the parameters should be fixed to. Can also be a valid Stan variable in the model. |
broadcast |
Should |
A named list with elements const
and broadcast
.
set_prior
stancode(count ~ Base + Age, data = epilepsy,
prior = prior(constant(1), class = "b"))
# will fail parsing because brms will try to broadcast a vector into a vector
stancode(count ~ Base + Age, data = epilepsy,
prior = prior(constant(alpha), class = "b"),
stanvars = stanvar(c(1, 0), name = "alpha"))
stancode(count ~ Base + Age, data = epilepsy,
prior = prior(constant(alpha, broadcast = FALSE), class = "b"),
stanvars = stanvar(c(1, 0), name = "alpha"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.