The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Continuous Analog of a Binomial Distribution
Version: 1.6
Date: 2021-04-28
Author: Dan Dalthorp
Maintainer: Dan Dalthorp <ddalthorp@protonmail.com>
Description: Implementation of the d/p/q/r family of functions for a continuous analog to the standard discrete binomial with continuous size parameter and continuous support with x in [0, size + 1], following Ilienko (2013) <doi:10.48550/arXiv.1303.5990>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Imports: Rcpp (≥ 0.12.0)
LinkingTo: Rcpp
RoxygenNote: 7.1.1
NeedsCompilation: yes
Packaged: 2021-04-28 16:23:35 UTC; ddalt
Repository: CRAN
Date/Publication: 2021-04-28 16:40:02 UTC

Continuous Analog of a Binomial Distribution

Description

Implementation of the d/p/q/r family of functions for a continuous analog to the standard discrete binomial with continuous size parameter and continuous support with x in [0, size + 1].

Details

Included in the package are functions dcbinom(x, size, prob, log = FALSE), pcbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE), qcbinom(p, size, prob, lower.tail = TRUE, log.p = FALSE), and rcbinom(n, size, prob. Usage closely parallels that of the binom family of functions in the stats R package.

Author(s)

Dan Dalthorp <ddalthorp@protonmail.gov>

References

Ilienko, Andreii (2013). Continuous counterparts of Poisson and binomial distributions and their properties. Annales Univ. Sci. Budapest., Sect. Comp. 39: 137-147. http://ac.inf.elte.hu/Vol_039_2013/137_39.pdf

See Also

pcbinom


The Continuous Binomial Distribution

Description

Density, distribution function, quantile function and random generation for a continuous analog to the binomial distribution with parameters size and prob. The usage and help pages are modeled on the d-p-q-r families of functions for the commonly-used distributions (e.g., dbinom) in the stats package.

Heuristically speaking, this distribution spreads the standard probability mass (dbinom) at integer x to the interval [x, x + 1] in a continuous manner. As a result, the distribution looks like a smoothed version of the standard, discrete binomial but shifted slightly to the right. The support of the continuous binomial is [0, size + 1], and the mean is approximately size * prob + 1/2.

Usage

  dcbinom(x, size, prob, log = FALSE)
  pcbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE)
  qcbinom(p, size, prob, lower.tail = TRUE, log.p = FALSE)
  rcbinom(n, size, prob)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

size

the size parameter.

prob

the prob parameter.

log, log.p

logical; if TRUE, probabilities p are given as log(p)

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]

Details

The cbinom package is an implementation of Ilienko's (2013) continuous binomial distribution.

The continuous binomial distribution with size = N and prob = p has cumulative distribution function

F(x) = \frac{B(x, N + 1 - x, p)}{B(x, N + 1 - x)}

for x in [0, N + 1], where

{B(x, N + 1 - x, p) = \int_{p}^{1} t^{x-1}(1-t)^{y-1}dt}

is the incomplete beta function and

{B(x, N + 1 - x) = \int_{0}^{1} t^{x-1}(1-t)^{y-1}dt}

is the beta function (or beta(x, N - x + 1) in R). The CDF can be expressed in R as F(x) = 1 - pbeta(prob, x, size - x + 1) and the mean calculated as integrate(function(x) pbeta(prob, x, size - x + 1), lower = 0, upper = size + 1).

If an element of x is not in [0, N + 1], the result of dcbinom is zero. The PDF dcbinom(x, size, prob) is computed via numerical differentiation of the CDF = 1 - pbeta(prob, x, size - x + 1).

Value

dcbinom is the density, pcbinom is the distribution function, qcbinom is the quantile function, and rcbinom generates random deviates.

The length of the result is determined by n for rbinom, and is the maximum of the lengths of the numerical arguments for the other functions.

The numerical arguments other than n are recycled to the length of the result.

References

Ilienko, Andreii (2013). Continuous counterparts of Poisson and binomial distributions and their properties. Annales Univ. Sci. Budapest., Sect. Comp. 39: 137-147. http://ac.inf.elte.hu/Vol_039_2013/137_39.pdf

Examples

require(graphics)
# Compare continous binomial to a standard binomial
size <- 20
prob <- 0.2
x <- 0:20
xx <- seq(0, 21, length = 200)
plot(x, pbinom(x, size, prob), xlab = "x", ylab = "P(X <= x)")
lines(xx, pcbinom(xx, size, prob))
legend('bottomright', legend = c("standard binomial", "continuous binomial"),
  pch = c(1, NA), lty = c(NA, 1))
mtext(side = 3, line = 1.5, text = "pcbinom resembles pbinom but continuous and shifted")
pbinom(x, size, prob) - pcbinom(x + 1, size, prob)

# Use "log = TRUE" for more accuracy in the tails and an extended range:
n <- 1000
k <- seq(0, n, by = 20)
cbind(exp(dcbinom(k, n, .481, log = TRUE)), dcbinom(k, n, .481))

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.