rvs(p, loc=0, size=1, random_state=None) | Random variates. |
pmf(k, p, loc=0) | Probability mass function. |
logpmf(k, p, loc=0) | Log of the probability mass function. |
cdf(k, p, loc=0) | Cumulative distribution function. |
logcdf(k, p, loc=0) | Log of the cumulative distribution function. |
sf(k, p, loc=0) | Survival function (also defined as 1 - cdf, but sf is sometimes more accurate). |
logsf(k, p, loc=0) | Log of the survival function. |
ppf(q, p, loc=0) | Percent point function (inverse of cdf — percentiles). |
isf(q, p, loc=0) | Inverse survival function (inverse of sf). |
stats(p, loc=0, moments=’mv’) | Mean(‘m’), variance(‘v’), skew(‘s’), and/or kurtosis(‘k’). |
entropy(p, loc=0) | (Differential) entropy of the RV. |
expect(func, args=(p,), loc=0, lb=None, ub=None, conditional=False) | Expected value of a function (of one argument) with respect to the distribution. |
median(p, loc=0) | Median of the distribution. |
mean(p, loc=0) | Mean of the distribution. |
var(p, loc=0) | Variance of the distribution. |
std(p, loc=0) | Standard deviation of the distribution. |
interval(confidence, p, loc=0) | Confidence interval with equal areas around the median. |
Notes
The probability mass function for geom is:
f(k)=(1−p)k−1p for k≥1, 0<p≤1
geom takes p as shape parameter,
where p is the probability of a single success
and 1−p is the probability of a single failure.
Note that when drawing random samples, the probability of observations that exceed
np.iinfo(np.int64).max increases rapidly as $p$ decreases below $10^{-17}$. For
$p < 10^{-20}$, almost all observations would exceed the maximum int64; however,
the output dtype is always int64, so these values are clipped to the maximum.
The probability mass function above is defined in the “standardized” form.
To shift distribution use the loc parameter.
Specifically, geom.pmf(k, p, loc) is identically
equivalent to geom.pmf(k - loc, p).
Examples
x
,
p
),
'bo'
,
ms
=
8
,
label
=
'geom pmf'
)
ax
.
vlines
(
x
,
0
,
geom
.
pmf
(
x
,
p
),
colors
=
'b'
,
lw
=
5
,
alpha
=
0.5
)
label
=
'frozen pmf'
)
ax
.
legend
(
loc
=
'best'
,
frameon
=
False
)
plt
.
show
()