sqi_entropy: Soil Quality Index: Entropy Weighting Method

View source: R/indexing.R

sqi_entropyR Documentation

Soil Quality Index: Entropy Weighting Method

Description

Computes SQI using Shannon entropy to derive objective weights for each variable. Variables with higher information entropy (greater discriminating power among groups) receive higher weights. This removes subjectivity from weight assignment.

The entropy weight for variable j is:

e_j = -\frac{1}{\ln n} \sum_{i=1}^{n} p_{ij} \ln(p_{ij})

w_j = \frac{1 - e_j}{\sum_k (1 - e_k)}

where p_{ij} = \bar{S}_{ij} / \sum_i \bar{S}_{ij}.

Usage

sqi_entropy(scored, config, group_cols = "LandUse", mds_vars = NULL)

Arguments

scored

A scored data frame from score_all.

config

A sqi_config object.

group_cols

Character vector of grouping column names.

mds_vars

Character vector of MDS variable names.

Value

A data frame with group columns, SQI_entropy, and attribute entropy_weights (named numeric vector).

References

Shannon, C.E. (1948). A mathematical theory of communication. Bell System Technical Journal, 27(3), 379–423. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/j.1538-7305.1948.tb01338.x")}

Li, P., Qian, H., & Wu, J. (2010). Groundwater quality assessment based on improved water quality index in Pengyang County, Ningxia, Northwest China. E-Journal of Chemistry, 7, 209–216. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1155/2010/451304")}

Examples

data(soil_data)
cfg <- make_config(
  variable = c("pH","EC","BD","OC","MBC","Clay"),
  type     = c("opt","less","less","more","more","opt"),
  opt_low  = c(6.0, NA, NA, NA, NA, 20),
  opt_high = c(7.0, NA, NA, NA, NA, 35)
)
scored <- score_all(soil_data, cfg, group_cols = c("LandUse","Depth"))
result <- sqi_entropy(scored, cfg, group_cols = c("LandUse","Depth"))
attr(result, "entropy_weights")


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