measrprior {measr} | R Documentation |
Prior definitions for measr models
Description
Create prior definitions for classes of parameters, or specific parameters.
Usage
measrprior(
prior,
class = c("structural", "intercept", "maineffect", "interaction", "slip", "guess"),
coef = NA,
lb = NA,
ub = NA
)
prior(prior, ...)
prior_(prior, ...)
prior_string(prior, ...)
Arguments
prior |
A character string defining a distribution in Stan language. A list of all distributions supported by Stan can be found in Stan Language Functions Reference at https://mc-stan.org/users/documentation/. |
class |
The parameter class. Defaults to |
coef |
Name of a specific parameter within the defined class. If not defined, the prior is applied to all parameters within the class. |
lb |
Lower bound for parameter restriction. Defaults to no restriction. |
ub |
Upper bound for parameter restriction. Defaults to no restriction. |
... |
Additional arguments passed to |
Value
A tibble of class measrprior
.
Functions
-
prior()
: Alias ofmeasrprior()
which allows arguments to be specified as expressions without quotation marks. -
prior_()
: Alias ofmeasrprior()
which allows arguments to be specified as one-sided formulas or wrapped inbase::quote()
. -
prior_string()
: Alias ofmeasrprior()
which allows arguments to be specified as character strings.
Examples
# Use alias functions to define priors without quotes, as formulas,
# or as character strings.
(prior1 <- prior(lognormal(0, 1), class = maineffect))
(prior2 <- prior_(~lognormal(0, 1), class = ~maineffect))
(prior3 <- prior_string("lognormal(0, 1)", class = "maineffect"))
identical(prior1, prior2)
identical(prior1, prior3)
identical(prior2, prior3)
# Define a prior for an entire class of parameters
prior(beta(5, 25), class = "slip")
# Or for a specific item (e.g., just the slipping parameter for item 7)
prior(beta(5, 25), class = "slip", coef = "slip[7]")