Darwin Help

Back to Index

Cumulative

Function Cumulative - compute the cumulative probability for x

Calling Sequence  Cumulative(distr,x)
Parameters
NameTypeDescription

distr anythingdescription of a probability distribution
x numerica number
Return Type  numeric
Synopsis This function computes the probability that a random distributed variable with distribution "distr" has a value less or equal to x. This is normally called the cumulative probability distribution. The result is between 0 and 1 inclusive. The format describing the distribution is the same as the one used by Rand. If x is continuously distributed, with density f(x), then the cumulative is:

                      x
                     /
                    |
Cumulative(f, x) =  |          f(t) dt
                    |
                   /
                     -infinity

If the distribution is a discrete distribution, say over the integers, then the cumulative is defined as:


                              /    x - 1         \
                              |    -----         |
                              |     \            |
Cumulative(f, x) = 1/2 f(x) + |      )       f(t)|
                              |     /            |
                              |    -----         |
                              \t = -infinity     /

The system knows how to compute the Cumulative distributions of: {Binomial,ChiSquare,LogIndepEvents,Normal,U}.


If the arguments are such that the value returned is too close to 1 or too close to 0 for accurate representation, consider using CumulativeStd which returns its result in equivalent standard deviations and will not suffer from precision problems. The relations between the Cumulative(c) and the CumulativeStd(s) are the following:


                   s
c = 1/2  (1 + erf(----))
                   1/2
                  2
 

                  s
c = 1 - 1/2 erfc(----)
                  1/2
                 2
 

                s
c = 1/2 erfc(- ----)
                1/2
               2
References Erdelyi53, Handbook of Mathematical functions, Abramowitz and Stegun, 7.1
Examples
> Cumulative( Binomial(10,0.5), 5 );
0.5000
> Cumulative( U(0,10), 7.5 );
0.7500
See also CumulativeStd,   OutsideBounds,   ProbBallsBoxes,   ProbCloseMatches,   Rand,   StatTest,   Std_Score