Geometric — The Geometric distribution

Usage

Geometric(p: Double) → Distribution<Int>

Arguments

p:

Success probability

Description

The geometric distribution gives the number of failures before the first success, where success has probability p. The probability mass function is:

Pr(X=n) = p*(1-p)^n

Sampled values are in the set {0, 1, 2, ... }.

Examples

~Geometric(0.1)          # A large number of failures.
~Geometric(0.9)          # A small number of failures.
add(1,~Geometric(0.9))   # A geometric starting at 1
~IID(10,Geometric[0.9))