Skip to contents

Functions to compute the probability density function, cumulative distribution function, and quantile function for the Bernoulli distribution.

Usage

bernoulli_pdf(x, p_success)

bernoulli_lpdf(x, p_success)

bernoulli_cdf(x, p_success)

bernoulli_lcdf(x, p_success)

bernoulli_quantile(p, p_success)

Arguments

x

quantile (0 or 1)

p_success

probability of success (0 <= p_success <= 1)

p

probability (0 <= p <= 1)

Value

A single numeric value with the computed probability density, log-probability density, cumulative distribution, log-cumulative distribution, or quantile depending on the function called.

See also

Boost Documentation for more details on the mathematical background.

Examples

bernoulli_pdf(1, 0.5)
#> [1] 0.5
bernoulli_lpdf(1, 0.5)
#> [1] -0.6931472
bernoulli_cdf(1, 0.5)
#> [1] 1
bernoulli_lcdf(1, 0.5)
#> [1] 0
bernoulli_quantile(0.5, 0.5)
#> [1] 0