inverse: Inverse CDF Function In GoFKernel: Testing Goodness-of-Fit with the Kernel Density Estimator

Description

Function to calculate the inverse function of a cumulative distribution function.

Usage

 `1` ```inverse(f, lower = -Inf, upper = Inf) ```

Arguments

 `f` a cdf function for which we want to obtain its inverse. `lower` the lower limit of `f` domain (support of the random variable), default -Inf. `upper` the upper limit of `f` domain (support of the random variable), default Inf.

Details

`inverse` is called by `random.function` and calculates the inverse of a given function `f`. `inverse` has been specifically designed to compute the inverse of the cumulative distribution function of an absolutely continuous random variable, therefore it assumes there is only a root for each value in the interval (0,1) between `f(lower)` and `f(upper)`. It is for internal use in `dgeometric.test`.

Value

A function, the inverse function of a cumulative distribution function `f`.

Note

This function uses either `optim` with default options `method="L-BFGS-B"` or `uniroot` to derive the inverse function.

The upper endpoint must be strictly larger than the lower endpoint.

Jose M. Pavia

References

See the references in `optim` and `uniroot`.

`dgeometric.test`, `integrate`, `optim`, `random.function`, `support.facto` and `uniroot`.

Examples

 ```1 2 3``` ```f <- function(x) pbeta(x, shape1=2, shape2=3) f.inv <- inverse(f,lower=0,upper=1) f.inv(.2) ```

Example output

```Loading required package: KernSmooth