<< distfun_geocdf Geometric distfun_geopdf >>

Distfun >> Distfun > Geometric > distfun_geoinv

distfun_geoinv

Geometric Inverse CDF

Calling Sequence

x = distfun_geoinv(p,pr)
x = distfun_geoinv(p,pr,lowertail)

Parameters

p :

a matrix of doubles, the probability. Must be in the range [0,1].

pr :

a matrix of doubles, the probability of success in a Bernoulli trial. pr in (0,1].

lowertail :

a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).

x :

a matrix of doubles, the outcome. x belongs to the set {0,1,2,3,......}

Description

Computes the Inverse cumulative distribution function of the Geometric distribution function.

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

Examples

// Test with p scalar, pr scalar
x = distfun_geoinv(0.999,0.5)
expected = 9;
x = distfun_geoinv(1-0.999,0.5,%f)
expected = 9;

// Test with expanded p , scalar pr
x = distfun_geoinv([0.32 0.3],0.2)
expected = [1. 1.];

// Test with scalar p, expanded pr
x = distfun_geoinv(0.22,[0.33 0.1])
expected = [0. 2.];

// Test small values of p
xn = distfun_geoinv(1.e-15,0.1)
expected = 0.;
xn = distfun_geoinv(1.e-15,0.1,%f)
expected = 327.;

// Test small values of pr
xn = distfun_geoinv(0.1,1.e-20)
expected = 10536051565782630122;
xn = distfun_geoinv(0.1,1.e-20,%f)
expected = 230258509299404568400;

Bibliography

http://en.wikipedia.org/wiki/Geometric_distribution

Authors


Report an issue
<< distfun_geocdf Geometric distfun_geopdf >>