narrow_by_discretes: Narrow a range of possible values by a discrete

View source: R/eval_quantile_from_cdf.R

narrow_by_discretesR Documentation

Narrow a range of possible values by a discrete

Description

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.


vincenzocoia/distionary documentation built on March 5, 2024, 3:13 a.m.