LINPRED_PRIORS {nimbleMacros} | R Documentation |
Macro to build code for priors on a linear predictor from an R formula
Description
Generates appropriate priors for a linear predictor derived from an R formula. As such it makes the most sense to use this macro together with the LINPRED macro, which takes similar arguments.
Arguments
formula |
An R formula The formula must be right-hand side only (e.g., |
coefPrefix |
All model coefficient names will begin with this prefix.
default is |
sdPrefix |
All dispersion parameters will begin with this prefix. Default is no prefix. |
priors |
List of prior specifications, generated using |
modelMatrixNames |
Logical indicating if parameters should be named so they match the
names one would get from R's |
noncentered |
Logical indicating whether to use noncentered parameterization
for random effects. Default is |
centerVar |
Grouping variable (covariate) to 'center' the random effects on.
By default (when NULL), random effects come from normal distributions with mean 0
as with |
modelInfo |
Used internally by nimbleMacros; a list of model information such as constants and dimensions |
.env |
Used internally by nimbleMacros; the environment where the model was created |
Value
NIMBLE code for the priors specified by the formula.
Author(s)
Ken Kellner
Examples
constants <- list(x = rnorm(3), x2 = factor(letters[1:3]))
code <- nimbleCode({
LINPRED_PRIORS(~x + x2)
})
mod <- nimbleModel(code, constants = constants)
mod$getCode()