Learn R Programming

dcmstan (version 0.1.0)

prior: Prior definitions for diagnostic classification models

Description

Define prior distributions for types of parameters or specific parameters within a model. For a complete list of types and parameters available for a given model, see get_parameters().

Usage

prior(distribution, type, coefficient = NA, lower_bound = NA, upper_bound = NA)

prior_string(distribution, ...)

Value

A dcmprior object.

Arguments

distribution

A distribution statement for the prior (e.g., normal(0, 2)). For a complete list of available distributions, see the Stan documentation at https://mc-stan.org/docs/.

type

The type of parameter to apply the prior to. Parameter types will vary by model. Use get_parameters() to see list of possible types for the chosen model.

coefficient

Name of a specific parameter within the defined parameter type. If NA (the default), the prior is applied to all parameters within the type.

lower_bound

Optional. The lower bound where the distribution should be truncated.

upper_bound

Optional. The upper bound where the distribution should be truncated.

...

Additional arguments passed to prior().

Details

prior() should be used for directly specifying priors. That is, when you are directly typing out or providing the distribution statement to the function. If you have previously created a variable with a distribution statement as a character string (e.g., dist <- "normal(0, 2)"), then you should use prior_string() to create your prior. See examples.

See Also

get_parameters().

Examples

Run this code
prior(normal(0, 2), type = "intercept")

c(prior(beta(5, 17), type = "slip"),
  prior(beta(5, 25), type = "guess"))

my_prior <- "normal(0, 2)"
prior_string(my_prior, type = "intercept")

Run the code above in your browser using DataLab