score_optimum: Score a Variable With an Optimum Value or Range (Bell Curve)

View source: R/scoring.R

score_optimumR Documentation

Score a Variable With an Optimum Value or Range (Bell Curve)

Description

Applies a bell-shaped (peaked) scoring function appropriate for soil variables that have an optimum range, beyond which both higher and lower values reduce soil quality. Classic examples include pH (optimal 6.0–7.0 for most crops) and clay content (Liebig et al., 1996; Karlen & Stott, 1994).

The scoring rules are:

  • S = 1 if x \in [\code{opt\_low}, \code{opt\_high}]

  • S = (x - x_{\min}) / (\code{opt\_low} - x_{\min}) if x < \code{opt\_low}

  • S = (x_{\max} - x) / (x_{\max} - \code{opt\_high}) if x > \code{opt\_high}

Usage

score_optimum(x, opt_low, opt_high, x_min = NULL, x_max = NULL)

Arguments

x

Numeric vector of raw variable values.

opt_low

Numeric. Lower bound of the optimum range.

opt_high

Numeric. Upper bound of the optimum range.

x_min

Numeric. Absolute minimum (score = 0). Defaults to min(x).

x_max

Numeric. Absolute maximum (score = 0). Defaults to max(x).

Value

Numeric vector of scores in [0, 1].

References

Karlen, D.L., & Stott, D.E. (1994). A framework for evaluating physical and chemical indicators of soil quality. In J.W. Doran et al. (Eds.), Defining Soil Quality for a Sustainable Environment, pp. 53–72. SSSA Special Publication 35. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2136/sssaspecpub35.c4")}

Liebig, M.A., Varvel, G., & Doran, J.W. (1996). A simple performance- based index for assessing multiple agroecosystem functions. Agronomy Journal, 88, 739–745. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2134/agronj1996.00021962008800050011x")}

Examples

ph <- c(4.5, 5.5, 6.2, 6.8, 7.0, 7.5, 8.2)
score_optimum(ph, opt_low = 6.0, opt_high = 7.0)

clay <- c(10, 18, 25, 32, 45, 60)
score_optimum(clay, opt_low = 20, opt_high = 35)


SQIpro documentation built on April 20, 2026, 5:06 p.m.