Looking in the documentation , I read
The probability density and cumulative distribution functions may be given using
PDF[BinomialDistribution[n,p],x]
andCDF[BinomialDistribution[n,p],x]
. The mean, median, variance, raw moments, and central moments may be computed usingMean
,Median
,Variance
,Moment
, andCentralMoment
, respectively. These quantities can be visualized usingDiscretePlot
and see an example
pdf=PDF[BinomialDistribution[n, p], k]
Piecewise[{{(1 - p)^(-k + n)*p^k*Binomial[n, k], 0 <= k <= n}}, 0]
But this does not possess usual properties of a PDF. For example,
n = 5; p = 1/3; NIntegrate[pdf, {k, -Infinity, Infinity}]
0.950953
and such a definition causes many bugs. Here is one of these.
ClearAll[n, p, x, y, n]; pdf = PDF[TransformedDistribution[ Max[x, y/n],
{Distributed[x, UniformDistribution[{0, 1}]], Distributed[y, BinomialDistribution[n, p]]}], t];
FullSimplify[pdf, Assumptions -> n \[Element] PositiveIntegers && 0 < p && p < 1 && t \[Element] Reals]
Piecewise[{{1 - (1 - p)^(-1 + n - Floor[n*t])*p^(1 + Floor[n*t])*Binomial[n, 1 + Floor[n*t]]* Hypergeometric2F1[1, 1 - n + Floor[n*t], 2 + Floor[n*t], p/(-1 + p)], Inequality[0, Less, t, LessEqual, 1] && n*t > Floor[n*t]}, {0, (t < 0 || t > 1) && n*t > Floor[n*t]}},Indeterminate]
n = 5; p = 1/3; NIntegrate[Piecewise[{{1 - (1 - p)^(-1 + n - Floor[n*t])*p^(1 + Floor[n*t])*
Binomial[n, 1 + Floor[n*t]]*Hypergeometric2F1[1, 1 - n + Floor[n*t], 2 + Floor[n*t],
p/(-1 + p)], Inequality[0, Less, t, LessEqual, 1] && n*t > Floor[n*t]}, {0, (t < 0 || t > 1) &&
n*t > Floor[n*t]}},Indeterminate], {t, -Infinity, Infinity}]
0.666662
The same issues with other discrete distributions and dozens of bugs may be presented in this field.
The question arises: is the quoted documentation correct or I don't understand something?