Determine Sweet Spot Bounds and Width
Source:R/analysis_compute_sweet_spot.R
sweet_spot_determination.RdThis function calculates the bounds and width of the "sweet spot" where a given y_values vector
crosses a specified reference_value. It uses linear interpolation for precise crossing points.
Usage
sweet_spot_determination(
x_values,
y_values,
reference_value = 0,
larger_is_better,
return_NA_at_boundaries = FALSE
)Arguments
- x_values
A numeric vector of x values.
- y_values
A numeric vector of y values.
- reference_value
A numeric reference value to determine the crossing points.
- larger_is_better
Whether larger
y_valuesare better. If FALSE, the sign of the comparison withreference_valueis reversed.- return_NA_at_boundaries
If TRUE, a sweet spot bound that falls on the edge of
x_valuesis reported as NA rather than as that edge.