Mirrors the C# UncertainOrderedPairedData.CurveSample()/CurveSample(double): collapses a
curve whose Y-coordinate is a whole distribution at each x down to a plain x-y curve, either
at the distributions' means (probability = NULL, the default) or at a shared quantile
(probability in [0, 1]).
Usage
uncertain_curve_sample(
x,
distributions,
probability = NULL,
order_x = "ascending",
order_y = "ascending",
strict_x = TRUE,
strict_y = TRUE
)Arguments
- x
numeric vector of x positions, at least one element.
- distributions
a
distribution()object, or a list of them the same length asx– one distribution per x position. A single distribution is recycled across everyx.- probability
quantile in
[0, 1]to sample at;NULL(default) samples the mean. Values outside[0, 1]are rejected – the underlying C#CurveSample(double)silently clamps them instead, so this range check is enforced here rather than core-side.- order_x, order_y
one of
"ascending"(default),"descending", or"none".- strict_x, strict_y
require x/y to strictly increase/decrease (per
order_x/order_y) between consecutive ordinates. DefaultTRUE.
Examples
x <- c(1, 2, 3, 5)
d <- list(distribution("Triangular", c(1, 2, 3)), distribution("Triangular", c(2, 4, 5)),
distribution("Triangular", c(6, 8, 12)), distribution("Triangular", c(13, 19, 20)))
uncertain_curve_sample(x, d, probability = 0.5)
#> x y
#> 1 1 2.000000
#> 2 2 3.732051
#> 3 3 8.535898
#> 4 5 17.582576