• https://me.yahoo.com
COST (GBP)
0.28
5.72
0

# PDF

Calculates the negative binomial distribution PDF.
Controller: CodeCogs
Contents

C++
Excel

## PDF

 doublePDF( int x int r double p )
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

$P_{r,p}&space;=&space;\left&space;(&space;\begin{array}{c}x+r-1\\r-1&space;\end{array}&space;\right&space;)&space;p^r&space;(1-p)^x$

where:
$\left&space;(&space;\begin{array}{c}x\\y&space;\end{array}&space;\right&space;)&space;=&space;\frac{x!}{(y!&space;(x-y)!}$

### 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.0550487

### Parameters

 x the number of failures r the threshold number of successes p the probability of success in each trial

### Authors

Eugene Dolinskyy
Updated by Will Bateman (August 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.