Validated random-number generators for distributions that are commonly
used as priors or for prior predictive simulation. All generators take the
number of draws as their first argument, sample_size.
Usage
student_t_prior(sample_size, nu = 1, mu = 0, sigma = 1)
normal_prior(sample_size, mu = 0, sigma = 1)
cauchy_prior(sample_size, location = 0, scale = 1)
uniform_prior(sample_size, min = 0, max = 1)
beta_prior(sample_size, shape1 = 1, shape2 = 1)
gamma_prior(sample_size, shape = 1, rate = 1)
binomial_prior(sample_size, size = 1, prob = 0.5)
poisson_prior(sample_size, lambda = 1)
lognormal_prior(sample_size, meanlog = 0, sdlog = 1)
bernoulli_prior(sample_size, prob = 0.5)Arguments
- sample_size
Positive integer: number of draws.
- nu
Degrees of freedom of the Student-t (must be positive).
- mu, location, meanlog
Location parameter.
- sigma, scale, sdlog
Scale parameter (must be positive).
- min, max
Bounds of the uniform distribution (
min < max).- shape1, shape2
Positive shape parameters of the beta distribution.
- shape, rate
Positive shape and rate of the gamma distribution.
- size
Number of trials of the binomial distribution.
- prob
Success probability in
[0, 1].- lambda
Positive Poisson rate.
Details
student_t_prior() draws from the location-scale Student-t
distribution, mu + sigma * T with T ~ t(nu), which is the distribution
that rstanarm::student_t() places on a coefficient. Versions of bmbeR
before 2.0.0 used a non-central t multiplied by sigma, whose mean is not
mu (see REVIEW.md in the source repository).
binomial_prior(), poisson_prior() and bernoulli_prior() generate
discrete data. They are not valid priors for regression coefficients,
which are continuous and unbounded, but they are handy when simulating
outcomes by hand.