public class InverseCdf extends Object implements Serializable
Class InverseCdf
evaluates the inverse of a continuous,
strictly monotone function. Its most obvious use is in evaluating inverses
of continuous distribution functions that can be defined by a user-supplied
function, which implements the InverseCdf
interface.
The inverse is computed using regula falsi and/or
bisection, possibly with the Illinois modification (see Dahlquist and Bjorck
1974). A maximum of 100 iterations are performed.
Modifier and Type | Class and Description |
---|---|
static class |
InverseCdf.DidNotConvergeException
The iteration did not converge
|
Constructor and Description |
---|
InverseCdf(CdfFunction cdf)
Constructor for the inverse of a user-supplied cummulative distribution function.
|
Modifier and Type | Method and Description |
---|---|
double |
eval(double p,
double guess)
Evaluates the inverse CDF function.
|
void |
setTolerance(double tolerance)
Sets the tolerance to be used as the convergence criterion.
|
public InverseCdf(CdfFunction cdf)
cdf
- is a CdfFunction
object that contains the user-supplied function
to be inverted. The cdf function must be continuous and
strictly monotone.public void setTolerance(double tolerance)
tolerance
- a double
scalar value representing the
convergence criterion. When the relative change from
one iteration to the next is less than tolerance,
convergence is assumed. The default value for tolerance
is 0.0001.public double eval(double p, double guess) throws InverseCdf.DidNotConvergeException
p
- a double
scalar value representing the point
at which the inverse CDF is desiredguess
- a double
scalar value representing an initial
estimate of the inverse at pdouble
scalar value representing the inverse
of the CDF at the point p. Cdf(inverseCdf) is "close" to p.InverseCdf.DidNotConvergeException
Copyright © 2020 Rogue Wave Software. All rights reserved.