Computes the HREL index for a vector of frequencies of categories.

HREL(x, na.rm = TRUE)

Arguments

x

a vector of frequencies

na.rm

if TRUE, missing values are removed. If FALSE, NA is returned if there is any NA value.

Value

The value of the HREL statistics, which is normalised (varies between 0 and 1).

Details

According to Wilcox (1973, p. 329), and following Senders (1958), the HREL is 'a measure originally developed by engineers for use in specifying the properties of communications channels. The rationale for HREL is presented in terms of guessing by Virginia Senders (supplementing the mode as best guess): "What we need is a measure of uncertainty, or of 'poorness of a guess,' which will be high when the number of alternative possibilities is high, and low when some ofthe possibilities are much more likely than others. One possible measure is the average number of questions we have to ask to specify the correct alternative'. The formula for the HREL is: $$- \frac{\sum_{i=1}^k \frac{f_i}{N} \log_2 \frac{f_i}{N}}{\log_2 K}$$

References

Wilcox, Allen R. 'Indices of Qualitative Variation and Political Measurement.' The Western Political Quarterly 26, no. 2 (1 June 1973): 325-43. doi:10.2307/446831. Senders, Virginia L. Measurement and Statistics. New York: Oxford University Press, 1958.

Examples

x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) HREL(x)
#> [1] 0.9942081
df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, HREL)
#> [1] 0.9973969 0.9991453 0.9918534 0.9519785 0.9966196 0.9945913 0.9912397 #> [8] 0.9940237 0.9891021 0.9927604