I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 1.00
sub units 14.08
+
0

CDF

Evaluates the binomial distribution CDF.
Controller: CodeCogs

Dependents

Info

Interface

C++

CDF

 
doubleCDFintk
intn
doublep
boolupper = false )
Evaluates the binomial distribution CDF:

There is an error with your graph parameters for CDF with options k=1 n=2:10:5 p=0:1

Error Message:Function CDF failed. Ensure that: Invalid C++

Example:

#include <stdio.h>
#include <codecogs/statistics/distributions/discrete/binomial/cdf.h>
int main()
{
  int k[10] = { 1, 2, 9, 9, 1, 0, 2, 1, 6, 8 };
  int n[10] = { 2, 4, 10, 14, 5, 2, 10, 1, 10, 18 };
  double p[10] = { 0.5, 0.5, 0.5, 0.6, 0.1, 0.4, 0.9, 0.1, 0.1, 0.4 };
  for( int i=0; i<10; i++ )
  {
    printf( "CDF(%i, %i, %1.1f, true) = %f \n",
      k[i], n[i], p[i], Stats::Dists::Discrete::Binomial::CDF( k[i], n[i], p[i], true ) );
  }
  return getchar();
}

Output:

CDF(1, 2, 0.5, true) = 0.250000
CDF(2, 4, 0.5, true) = 0.312500
CDF(9, 10, 0.5, true) = 0.000977
CDF(9, 14, 0.6, true) = 0.279257
CDF(1, 5, 0.1, true) = 0.081460
CDF(0, 2, 0.4, true) = 0.640000
CDF(2, 10, 0.9, true) = 1.000000
CDF(1, 1, 0.1, true) = 0.000000
CDF(6, 10, 0.1, true) = 0.000009
CDF(8, 18, 0.4, true) = 0.263159

Accuracy:

Tested at random points (a,b,p).
     p       a,b domain   # trials      peak         rms
0.001 to 1     0,100       100000      6.7e-15     8.2e-16
0 to 0.001     0,100       100000      1.5e-13     2.7e-15

Parameters

kthe maximum number of successes
nthe total number of trials, must be >= k
pthe probability of success for each trial, must be in range 0..1
upperDefault value = false

Returns

the value of the upper or lower tail of the binomial CDF with the given arguments

Authors

Stephen L. Moshier (June 2000)
Updated by Vince Cole (April 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.