Learn R Programming

Distributacalcul (version 0.4.0)

binom: Binomial Distribution

Description

Binomial distribution with size \(n\) and probability of success \(p\).

Usage

expValBinom(size, prob)

varBinom(size, prob)

expValTruncBinom(d, size, prob, less.than.d = TRUE)

VatRBinom(kap, size, prob)

TVatRBinom(kap, size, prob)

pgfBinom(t, size, prob)

mgfBinom(t, size, prob)

Value

Function :

  • mgfBinom gives the moment generating function (MGF).

  • pgfBinom gives the probability generating function (PGF).

  • expValBinom gives the expected value.

  • varBinom gives the variance.

  • expValTruncBinom gives the truncated mean.

  • TVatRBinom gives the Tail Value-at-Risk.

  • VatRBinom gives the Value-at-Risk.

Invalid parameter values will return an error detailing which parameter is problematic.

Arguments

size

Number of trials (0 or more).

prob

Probability of success in each trial.

d

cut-off value.

less.than.d

logical; if TRUE (default) truncated mean for values <= d, otherwise, for values > d.

kap

probability.

t

t.

Details

The binomial distribution with probability of success \(p\) for \(n\) trials has probability mass function : $$Pr(X = k) = \left(\frac{n}{k}\right) p^n (1 - p)^{n - k}$$ for \(k = 0, 1, 2, \dots, n\), \(p \in [0, 1]\), and \(n > 0\)

Examples

Run this code
expValBinom(size = 3, prob = 0.5)

varBinom(size = 3, prob = 0.5)


expValTruncBinom(d = 2, size = 3, prob = 0.5)
expValTruncBinom(d = 0, size = 3, prob = 0.5, less.than.d = FALSE)


VatRBinom(kap = 0.8, size = 5, prob = 0.2)

TVatRBinom(kap = 0.8, size = 5, prob = 0.2)


pgfBinom(t = 1, size = 3, prob = 0.5)

mgfBinom(t = 1, size = 3, prob = 0.5)

Run the code above in your browser using DataLab