Qu

geopdf

Builtin index · Statistics & ML

result = geopdf(k, p)

Input: k, p · Output: result

What it is

Probability mass of the geometric distribution at k (a number, vector or matrix, elementwise); zero at a non-integer or out-of-support k. Support: 0, 1, 2, ... failures before the first success.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = geopdf(k, p)
k —zero at a non-integer or out-of-support k.
p —not documented yet
result —
Returns the same shape as k. Added in v0.4.4.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

print("geo = nbin(r=1): {geopdf(3, 0.2)} {nbinpdf(3, 1, 0.2)}")
print("bern = bino(n=1): {bernpdf(1, 0.3)} {binopdf(1, 1, 0.3)}")
print("chi2 = gam(k/2, 2): {chi2cdf(4.5, 3)} {gamcdf(4.5, 1.5, 2)}")
print("exp = gam(1, mu): {expcdf(2, 3)} {gamcdf(2, 1, 3)}")
print("bino -> poiss: {binocdf(3, 10000, 0.0004)} vs {poisscdf(3, 4)}")

s = hygestat(50, 10, 12)
print("hypergeometric mean {s.mean}, variance {round(s.var, 4)}")

x = gamrnd(2.5, 1.5, 5000, 1, seed = 7)
g = gamfit(x)
print("gamfit: a = {round(g.a, 2)}, b = {round(g.b, 2)}, loglik = {round(g.loglik, 1)}")
k = binoinv(0.95, 20, 0.3)
print("95% of Binomial(20, 0.3) draws are <= {k}: binocdf = {round(binocdf(k, 20, 0.3), 4)}")
output
geo = nbin(r=1): 0.1024 0.1024
bern = bino(n=1): 0.3 0.3
chi2 = gam(k/2, 2): 0.78771 0.78771
exp = gam(1, mu): 0.486583 0.486583
bino -> poiss: 0.433431 vs 0.43347
hypergeometric mean 2.4, variance 1.489
gamfit: a = 2.55, b = 1.47, loglik = -10647.1
95% of Binomial(20, 0.3) draws are <= 9: binocdf = 0.952

from statistics-ml