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
"intercept"
. Must be one of"intercept"
,"maineffect"
,"interaction"
for the LCDM, or one of"slip"
or"guess"
for DINA or DINO models.- 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
measrprior()
.
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))
#> # A tibble: 1 × 3
#> class coef prior_def
#> <chr> <chr> <chr>
#> 1 maineffect NA lognormal(0, 1)
(prior2 <- prior_(~lognormal(0, 1), class = ~maineffect))
#> # A tibble: 1 × 3
#> class coef prior_def
#> <chr> <chr> <chr>
#> 1 maineffect NA lognormal(0, 1)
(prior3 <- prior_string("lognormal(0, 1)", class = "maineffect"))
#> # A tibble: 1 × 3
#> class coef prior_def
#> <chr> <chr> <chr>
#> 1 maineffect NA lognormal(0, 1)
identical(prior1, prior2)
#> [1] TRUE
identical(prior1, prior3)
#> [1] TRUE
identical(prior2, prior3)
#> [1] TRUE
# Define a prior for an entire class of parameters
prior(beta(5, 25), class = "slip")
#> # A tibble: 1 × 3
#> class coef prior_def
#> <chr> <chr> <chr>
#> 1 slip NA beta(5, 25)
# Or for a specific item (e.g., just the slipping parameter for item 7)
prior(beta(5, 25), class = "slip", coef = "slip[7]")
#> # A tibble: 1 × 3
#> class coef prior_def
#> <chr> <chr> <chr>
#> 1 slip slip[7] beta(5, 25)