Package 'frbinom'

Title: Fractional Binomial Distributions
Description: Generating fractional binomial random variables and computing density, cumulative distribution, and quantiles of fractional binomial distributions. (Lee, J. (2023) <arXiv:2209.01516>.)
Authors: Jeonghwa Lee [aut, cre, cph], Daniel Gernander [ctb]
Maintainer: Jeonghwa Lee <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2025-02-16 04:45:50 UTC
Source: https://github.com/leejeo25/frbinom

Help Index


Fractional binomial distributions

Description

Generating random variables and computing density, cumulative distribution, and quantiles of the fractional binomial distribution with the parameters size, prob, h, c.

Usage

dfrbinom(x, size, prob, h, c, start = FALSE)

pfrbinom(x, size, prob, h, c, start = FALSE)

qfrbinom(p, size, prob, h, c, start = FALSE)

rfrbinom(n, size, prob, h, c, start = FALSE)

Arguments

x

A numeric vector specifying values of the fractional binomial random variable at which the pmf or cdf is computed.

size

A number specifying the total number of trials.

prob

A number specifying the probability of success in each trial.

h

A number specifying the strength of the dependency among trials; it determines the skewness of the distribution.

c

A number specifying the overdispersion of distributions.

start

logical; if TRUE, the starting point is changed after the first success in the generalized Bernoulli process. The default is FALSE.

p

A numeric vector specifying probabilities at which quantiles of the fractional binomial distribution are computed.

n

A number of random variables to be simulated.

Details

The regular binomial random variable counts the number of successes in i.i.d. Bernoulli trials. In the fractional binomial distribution, the number of successes is counted among dependent Bernoulli trials that are from the generalized Bernoulli process (GBP). In GBP, each trial has the constant probability of success prob, and the strength of the dependency among the trials is determined by the parameters, h and c. The parameters c and h are related to the overdispersion and skewness of the fractional binomial distribution. The parameters prob=pp, h=HH, c=cc should satisfy p,H(0,1)p,H \in (0,1) and

0c<min{1p,12(2p+22H2+4pp22H+24H4)}.0\leq c<\min\{1-p, \frac{1}{2} ( -2p+2^{2H-2} +\sqrt{4p-p2^{2H}+2^{4H-4}})\}.

With the number of trials (size) =nn, the mean of the fractional binomial random variable is E(X)=npE(X)=np, and the variance is asymptotically proportional to n2Hn^{2H}, if H(0.5,1)H\in (0.5, 1); nlnnn\ln n, if H=0.5H=0.5; and nn, if H(0,.5)H\in (0, .5). If c=0, it becomes the regular binomial distribution.

Value

A numeric vector of random variables (rfrbinom) or pmf (dfrbinom) or cdf (pfrbinom) or quantile (qfrbinom) of the fractional binomial distribution.

Functions

  • dfrbinom(): The pmf of fractional binomial distribution.

  • pfrbinom(): The cdf of fractional binomial distribution.

  • qfrbinom(): The quantiles of fractional binomial distribution.

  • rfrbinom(): The generation of fractional binomial random variables.

References

Lee, J. (2021). Generalized Bernoulli process with long-range dependence and fractional binomial distribution. Dependence Modeling, 9(1), 1-12.

Examples

# 10 random variables of a fractional binomial distribution.
rfrbinom(n=10, size=50, prob=.6, h=.8, c=.2)
# The probability that the fractional binomial random variable equals 22.
dfrbinom(x=22, size=50, prob=.6, h=.8, c=.2)
# The probability that the fractional binomial random variable is less than or equal to 22.
pfrbinom(x=22, size=50, prob=.6, h=.8, c=.2)
 # The 80th percentile of the fractional binomial distribution.
qfrbinom(p=.8, size=50, prob=.6, h=.8, c=.2)

Fractional binomial distribution II

Description

Generating random variables and computing density, cumulative distribution, and quantiles of the fractional binomial distribution II with the parameters size, h, c, la.

Usage

dfrbinom2(x, size, h, c, la = c/2, start = FALSE)

pfrbinom2(x, size, h, c, la = c/2, start = FALSE)

qfrbinom2(p, size, h, c, la = c/2, start = FALSE)

rfrbinom2(n, size, h, c, la = c/2, start = FALSE)

Arguments

x

A numeric vector specifying values of the fractional binomial random variable II at which the pmf or cdf is computed.

size

A number specifying the total number of trials.

h

A number specifying the strength of the dependency among trials.

c

A number specifying the dispersion of distributions.

la

A number related to the probability of success in a trial; the default value is c/2.

start

logical; if TRUE, the starting point is changed after the first success in the generalized Bernoulli process II. The default is FALSE.

p

A numeric vector specifying probabilities at which quantiles of the fractional binomial distribution II are computed.

n

A number of random variables to be simulated.

Details

In the fractional binomial distribution II, the number of successes is counted in the generalized Bernoulli process II (GBP II). In GBP II, each trial has the constant probability of success la*size^{2h-2}, and the strength of the dependency among the trials is determined by the parameters, h and c. The parameters h=HH, c=cc, la=λ\lambda should satisfy H(0.5,1)H \in (0.5,1), 0<c<22H20< c< 2^{2H-2}, and 0<λ<c0<\lambda<c. With the number of trials (size) =nn, the mean of the fractional binomial random variable II is E(X)=nλ2H1E(X)=n\lambda^{2H-1}, and the k-th moment is asymptotically proportional to n(2H1)kn^{(2H-1)k} for k2k\geq 2.

Value

A numeric vector of random variables (rfrbinom2) or pmf (dfrbinom2) or cdf (pfrbinom2) or quantile (qfrbinom2) of the fractional binomial distribution II.

Functions

  • dfrbinom2(): The pmf of fractional binomial distribution II.

  • pfrbinom2(): The cdf of fractional binomial distribution II.

  • qfrbinom2(): The quantiles of fractional binomial distribution II.

  • rfrbinom2(): The generation of fractional binomial random variables II.

References

Lee, J. (2023). Generalized Bernoulli process and fractional Poisson process. arXiv:2209.01516.

Examples

# 10 random variables of a fractional binomial distribution II.
rfrbinom2(n=10, size=50, h=.8, c=.2)
# The probability that the fractional binomial random variable II equals 22.
dfrbinom2(x=22, size=50, h=.8, c=.2)
# The probability that the fractional binomial random variable II is less than or equal to 22.
pfrbinom2(x=22, size=50, h=.8, c=.2)
 # The 80th percentile of the fractional binomial distribution.
qfrbinom2(p=.8, size=50, h=.8, c=.2)