Skip to contents

For each observation, the conditional mean of the unobserved value given that it exceeds that observation's lower[i] – \(E[X \mid X > lower_i]\) – estimated by integrating a piecewise-uniform density built from tda_midf's CDF estimate over the induced partition – TDA's midf2: it builds the CDF at every breakpoint, then integrates the resulting piecewise-constant density from each observation's value onward, normalizing by the survival probability there.

Usage

tda_midf2(lower, upper, dir = tempfile("tda"))

Arguments

lower, upper

numeric vectors, the same length, with lower[i] != upper[i] for every i.

dir

working directory.

Value

A numeric vector, the same length as lower, in the original (unsorted) order.

Examples

lo <- c(0, 1, 2, 3, 1)
up <- c(2, 3, 4, 5, 2)
# the expected value of each observation given that it lies in its
# interval, under the estimated distribution
tda_midf2(lo, up)
#> [1] 2.300000 2.500000 3.300000 3.833333 2.500000