Learn R Programming

boostmath (version 1.0.0)

binomial_distribution: Binomial Distribution Functions

Description

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

Usage

binomial_pdf(k, n, prob)

binomial_lpdf(k, n, prob)

binomial_cdf(k, n, prob)

binomial_lcdf(k, n, prob)

binomial_quantile(p, n, prob)

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.

Arguments

k

number of successes (0 <= k <= n)

n

number of trials (n >= 0)

prob

probability of success on each trial (0 <= prob <= 1)

p

probability (0 <= p <= 1)

See Also

Boost Documentation for more details on the mathematical background.

Examples

Run this code
# Binomial dist ribution with n = 10, prob = 0.5
binomial_pdf(3, 10, 0.5)
binomial_lpdf(3, 10, 0.5)
binomial_cdf(3, 10, 0.5)
binomial_lcdf(3, 10, 0.5)
binomial_quantile(0.5, 10, 0.5)

Run the code above in your browser using DataLab