FUNCTION
Evaluates the binomial distribution probability density function.
You're viewing an older version of this page (#5444). View the current version.
Interface
#include <codecogs/statistics/distributions/discrete/binomial/pdf.h>
using namespace Statistics::Distributions::Discrete::Binomial;
The binomial distribution gives the discrete probability distribution
$$P_p(s|n)$$
(1)
of obtaining exactly s successes out of n Bernoulli trials (where the result of each Bernoulli trial is true with probability p and false with probability <em>1-p</em>). The binomial distribution is therefore given by:
$$P_p(s|n) = \frac{n!}{s!(n-s)!} p^s (1-p)^{n-s}$$
(2)
References
MathWorld, http://mathworld.wolfram.com/BinomialDistribution.html
Example 1
#include<iostream>
#include<codecogs/statistics/distributions/discrete/binomial/pdf.h>
int main()
{
std::cout << "binomial PDF: " << Statistics::Distributions::Discrete::Binomial::PDF(0.3,2,5) << std::endl;
return 0;
}Output:
binomial PDF: 0.3087Parameters
p
is the probability of success on any one trial
s
is the number of successes
n
is the number of events
Interactive Calculator
p
s
n
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.