measrprior: Prior definitions for measr models

View source: R/priors.R

measrpriorR 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 "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))

(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]")

wjakethompson/measr documentation built on April 12, 2025, 9:46 p.m.