FUNCTION
Calculates the negative binomial distribution PDF.
You're viewing an older version of this page (#156). View the current version.
Interface
#include <codecogs/statistics/distributions/discrete/negativebinomial/pdf.h>
using namespace Statistics::Distributions::Discrete::Negativebinomial;
The negative binomial distribution, also known as the Pascal distribution or Polya distribution, gives the probability of <em>r -1</em> successes and x failures in <em>x+r - 1</em> trials, and success on the <em>(x+r)</em> trial. The probability density is given by
(1)
where:
(2)
Example 1
#include <iostream>
#include <codecogs/stats/dists/discrete/negativebinomial/pdf.h>
using namespace Stats::Dists::Discrete::NegativeBinomial;
int main()
{
std::cout << "\n PDF(10,5,0.25) = " << PDF(10, 5, 0.25);
return 0;
}Output:
PDF(10,5,0.25) = 0.0550487Parameters
x
the number of failures
r
the threshold number of successes
p
the probability of success in each trial
Interactive Calculator
x
r
p
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.