Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

betabinom

The Beta-Binomial Distribution


Description

Density, distribution function, quantile function and random generation for the beta-binomial distribution when parameterized by the mean mu and the overdispersion parameter rho rather than the typical shape parameters.

Usage

dbetabinom(x, size, mu, rho, log)

pbetabinom(q, size, mu, rho, log_p)

qbetabinom(p, size, mu, rho)

rbetabinom(n, size, mu, rho)

Arguments

x, q

A vector of quantiles.

size

A vector of sizes.

mu

Either a scalar of the mean for each observation, or a vector of means of each observation, and thus the same length as x and size. This must be between 0 and 1.

rho

Either a scalar of the overdispersion parameter for each observation, or a vector of overdispersion parameters of each observation, and thus the same length as x and size. This must be between 0 and 1.

log, log_p

A logical vector either of length 1 or the same length as x and size. This determines whether to return the log probabilities for all observations (in the case that its length is 1) or for each observation (in the case that its length is that of x and size).

p

A vector of probabilities.

n

The number of observations.

Details

Let μ and ρ be the mean and overdispersion parameters. Let α and β be the usual shape parameters of a beta distribution. Then we have the relation

μ = α/(α + β),

and

ρ = 1/(1 + α + β).

This necessarily means that

α = μ (1 - ρ)/ρ,

and

β = (1 - μ) (1 - ρ)/ρ.

Value

Either a random sample (rbetabinom), the density (dbetabinom), the tail probability (pbetabinom), or the quantile (qbetabinom) of the beta-binomial distribution.

Functions

  • dbetabinom: Density function.

  • pbetabinom: Distribution function.

  • qbetabinom: Quantile function.

  • rbetabinom: Random generation.

Author(s)

David Gerard

Examples

x <- rbetabinom(n = 10, size = 10, mu = 0.1, rho = 0.01)
dbetabinom(x = 1, size = 10, mu = 0.1, rho = 0.01, log = FALSE)
pbetabinom(q = 1, size = 10, mu = 0.1, rho = 0.01, log_p = FALSE)
qbetabinom(p = 0.6, size = 10, mu = 0.1, rho = 0.01)

updog

Flexible Genotyping for Polyploids

v2.0.2
GPL-3
Authors
David Gerard [aut, cre] (<https://orcid.org/0000-0001-9450-5023>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.