Density (pdf / lpdf), distribution function (cdf / ccdf), quantile function (quant), random generation (rng), mean, standard deviation (sd), and marginal variants of the functions (mpdf, mlpf, mcdf, mccdf, mquant) for prior distributions.

# S3 method for prior
rng(x, n, ...)

# S3 method for prior
cdf(x, q, ...)

# S3 method for prior
ccdf(x, q, ...)

# S3 method for prior
lpdf(x, y, ...)

# S3 method for prior
pdf(x, y, ...)

# S3 method for prior
quant(x, p, ...)

# S3 method for prior
mcdf(x, q, ...)

# S3 method for prior
mccdf(x, q, ...)

# S3 method for prior
mlpdf(x, y, ...)

# S3 method for prior
mpdf(x, y, ...)

# S3 method for prior
mquant(x, p, ...)

Arguments

x

prior distribution

n

number of observations

...

unused arguments

q

vector or matrix of quantiles

y

vector of observations

p

vector of probabilities

Value

pdf (mpdf) and lpdf (mlpdf) give the (marginal) density and the log of (marginal) density, cdf (mcdf) and ccdf (mccdf) give the (marginal) distribution and the complement of (marginal) distribution function, quant (mquant) give the (marginal) quantile function, and rng generates random deviates for an object of class 'prior'.

Examples

# create a standard normal prior distribution
p1 <- prior(distribution = "normal", parameters = list(mean = 1, sd = 1))

# generate a random sample from the prior
rng(p1, 10)
#>  [1]  1.45018710  0.98144017  0.68193163  0.07063785 -0.48746031 -0.07519230
#>  [7]  2.00002880  0.37873331 -0.38442685  2.86929062

# compute cumulative density function
cdf(p1, 0)
#> [1] 0.1586553

# obtain quantile
quant(p1, .5)
#> [1] 1

# compute probability density
pdf(p1, c(0, 1, 2))
#> [1] 0.2419707 0.3989423 0.2419707