<< distfun_erfcinv Support distfun_genericpdf >>

Distfun >> Distfun > Support > distfun_gammainc

distfun_gammainc

Regularized incomplete Gamma function

Calling Sequence

y = distfun_gammainc ( x , a )
y = distfun_gammainc ( x , a , lowertail )

Parameters

x :

a matrix of doubles, the upper limit of integration of the gamma density, x>=0.

a :

a matrix of doubles, the parameter. a>0

lowertail :

a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then computes the integral from 0 to x otherwise from x to infinity.

y :

a matrix of doubles, the incomplete gamma function.

Description

Returns the regularized incomplete gamma function. If lowertail=%t, the function definition is:

If lowertail=%f, the function definition is:

We have

The lowertail option may be used to overcome the limitations of floating point arithmetic. We may use lowertail=%f when the output of the gamminc function with lowertail=%t is very close to 1.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

Notes

The function P(x,a) is the cumulative distribution function of a Gamma random variable with shape parameter a and scale parameter 1.

If a>0 is an integer, then Q(x,a) is the cumulative distribution function of a Poisson random variable with mean equal to a.

When a→0, lim P(x,a)=1, and lim Q(x,a)=0

Examples

distfun_gammainc(1,2) // Expected : 0.264241117657115
distfun_gammainc(2,3) // Expected : 0.323323583816936
distfun_gammainc(2,3,%t) // Expected : 0.323323583816936
// We have distfun_gammainc(x,a,%t) == 1 - distfun_gammainc(x,a,%f)
distfun_gammainc(2,3,%f) // Expected : 0.676676416183064

// The following example shows how to use the tail argument.
// For a=1 and x>40, the result is so close to 1 that the
// result is represented by the floating point number y=1.
distfun_gammainc(40,1) // Expected : 1
// This is why we may compute the complementary probability with
// the tail option.
distfun_gammainc(40,1,%f) // Expected : 4.248354255291594e-018

// Show the expansion of a
x = [1 2 3;4 5 6];
a = 2;
distfun_gammainc(x,a)

// Plot the function
a = [1 2 3 5 9];
cols = [1 2 3 4 5];
nf = size(cols,"*");
lgd = [];
scf();
for k = 1 : nf
x = linspace(0,20,1000);
y = distfun_gammainc ( x , a(k) );
plot(x,y)
str = msprintf("a=%s",string(a(k)));
lgd($+1) = str;
end
h = gcf();
for k = 1 : nf
hk = h.children.children.children(nf - k + 1);
hk.foreground = cols(k);
end
xtitle("Regularized Incomplete Gamma","x","P(x,a)")
legend(lgd);

Authors


Report an issue
<< distfun_erfcinv Support distfun_genericpdf >>