Skip to contents

Create prior definitions for classes of parameters, or specific parameters.

Usage

measrprior(
  prior,
  class = c("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 of measrprior() which allows arguments to be specified as expressions without quotation marks.

  • prior_: Alias of measrprior() which allows arguments to be specified as one-sided formulas or wrapped in base::quote().

  • prior_string: Alias of measrprior() 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