Skip to contents

Calculates the smallest value for which a function f evaluates to be greater than or equal to y -- that is, the left inverse of f at y. Intended for internal use only.

Usage

directional_inverse(distribution, p, low, high, tol, maxiter, direction)

Arguments

distribution

A distribution having access to a cdf.

p

Single value for which to calculate the left inverse.

low, high

Single numeric values forming a range within which to search for the solution.

tol, maxiter

Tolerance (a small positive number) and maximum number of iterations

direction

One of "left" for calculating left-inverse, or "right" for calculating right-inverse.

Details

This algorithm works by progressively cutting the specified range in half, so that the width of the range after k iterations is 1/2^k times the original width.