Skip to contents

When finding the inverse of the cdf at p, and with the solution between low and high, this function narrows this range based on an intermediate discrete value, and zeroes-in on that discrete value if it's the solution.

Usage

narrow_by_discretes(distribution, p, low, high, discrete, direction)

Arguments

distribution

A distribution having access to a cdf.

p

Value of the cdf to calculate inverse at.

low, high

Single numerics specifying the lower and upper bound to look between.

discrete

Numeric value indicating a discrete point to possibly narrow the range by. Could be NA; could have length 0; could be outside of the range c(low, high).

direction

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

Note

The benefit of this step when inverting a cdf is to return the exact discrete value if p falls within its jump discontinuity.