| score_trapezoid | R Documentation |
Applies a trapezoidal scoring function where scores are 1 within an
ideal plateau [opt_low, opt_high], rise linearly from 0
at min_val to 1 at opt_low, and fall linearly from 1 at
opt_high to 0 at max_val. Values outside
[min_val, max_val] receive a score of 0.
This function is more flexible than score_optimum because
the user explicitly controls the zero-score boundaries, making it
suitable for variables with well-established critical thresholds.
score_trapezoid(x, min_val, opt_low, opt_high, max_val)
x |
Numeric vector of raw variable values. |
min_val |
Numeric. Value at which score becomes 0 on the low side. |
opt_low |
Numeric. Lower bound of the plateau (score = 1). |
opt_high |
Numeric. Upper bound of the plateau (score = 1). |
max_val |
Numeric. Value at which score becomes 0 on the high side. |
Numeric vector of scores in [0, 1].
Wymore, A.W. (1993). Model-Based Systems Engineering. CRC Press, Boca Raton, FL.
Buse, R., & Lele, S. (2003). Trapezoidal membership functions in fuzzy soil quality assessment. Geoderma, 114, 177–196.
ph <- c(3.5, 5.0, 6.5, 7.0, 7.8, 8.5, 9.5)
# pH: absolute zero below 4 and above 9; ideal 6.0-7.0
score_trapezoid(ph, min_val = 4.0, opt_low = 6.0,
opt_high = 7.0, max_val = 9.0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.