# Create a ProbabilityDistribution

I am trying to wrap my head around the function ProbabilityDistribution. For training purpose, I'd like to recreate the binomial distribution (without using it) so that the two code lines return the same output.

PDF[BinomialDistribution[n, p], k]

PDF[MyBinomialDistribution[n, p], k]


My try

I would construct this function more or less like this

MyBinomialDistribution =
ProbabilityDistribution[
Binomial[n, k] p^k (1 - p)^(n - k), {k, 0, Infinity}, {n, 0, Infinity}, {p, 0, 1}
]

PDF[MyBinomialDistribution[n, p], k]


but it obviously doesn't work! Thanks for your help!

• MyBinomialDistribution should be a function of n and p.

• There is only one variable k. n and p are parameters

The correct definition is

MyBinomialDistribution[n_, p_] :=
ProbabilityDistribution[Binomial[n, k] p^k (1 - p)^(n - k), {k, 0, n, 1}]

PDF[BinomialDistribution[n, p], k] PDF[MyBinomialDistribution[n, p], k] • That totally makes sense. Thank you! – Remi.b Oct 21 '14 at 22:05