Last chance! 50% off unlimited learning
Sale ends in
Define a distribution for PSA parameters.
normal(mean, sd)lognormal(mean, sd, meanlog, sdlog)
gamma(mean, sd)
binomial(prob, size)
multinomial(...)
logitnormal(mu, sigma)
beta(shape1, shape2)
triangle(lower, upper, peak = (lower + upper)/2)
poisson(mean)
define_distribution(x)
beta(shape1, shape2)
triangle(lower, upper, peak = (lower + upper)/2)
use_distribution(distribution, smooth = TRUE)
Distribution mean.
Distribution standard deviation.
Mean on the log scale.
SD on the log scale.
Proportion.
Size of sample used to estimate proportion.
Dirichlet distribution parameters.
Mean on the logit scale.
SD on the logit scale.
for beta distribution
for beta distribution
lower bound of triangular distribution.
upper bound of triangular distribution.
peak of triangular distribution.
A distribution function, see details.
A numeric vector of observations defining a distribution, usually the output from an MCMC fit.
Use gaussian kernel smoothing?
These functions are not exported, but only used
in define_psa()
. To specify a user-made
function use define_distribution()
.
use_distribution()
uses gaussian kernel
smoothing with a bandwidth parameter calculated
by stats::density()
. Values for unobserved
quantiles are calculated by linear
interpolation.
define_distribution()
takes as argument a
function with a single argument, x
,
corresponding to a vector of quantiles. It
returns the distribution values for the given
quantiles. See examples.
define_distribution(
function(x) stats::qexp(p = x, rate = 0.5)
)
# a mixture of 2 gaussians
x <- c(rnorm(100), rnorm(100, 6))
plot(density(x))
use_distribution(x)
Run the code above in your browser using DataLab