Skip to contents

For each interval i, averages the lower endpoints of every interval (itself included) whose lower endpoint falls within [lower[i], upper[i]], and separately averages the upper endpoints falling in that same range – TDA's midf3. A local smoothing of nearby endpoints, not a distribution estimate like tda_midf/tda_midf1/ tda_midf2.

Usage

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

Arguments

lower, upper

numeric vectors, the same length.

dir

working directory.

Value

A list, both the same length as lower, in the original order: lower_avg, the average nearby lower endpoint; upper_avg, the average nearby upper endpoint.

Examples

lo <- c(0, 1, 2, 3, 1)
up <- c(2, 3, 4, 5, 2)
# for each interval, the mean lower and upper endpoint of the
# intervals overlapping it
tda_midf3(lo, up)
#> $lower_avg
#> [1] 1.000000 1.750000 2.500000 3.000000 1.333333
#> 
#> $upper_avg
#> [1] 2.000000 2.333333 2.750000 4.000000 2.000000
#>