Computes the average deviation analog (ADA) for a vector of frequencies of categories.
ADA(x, na.rm = TRUE)
x | a vector of frequencies |
---|---|
na.rm | if TRUE, missing values are removed. If FALSE, NA is returned if there is any NA value. |
The value of the ADA statistics, which is normalised (varies between 0 and 1).
According to Wilcox (1973, p. 328), the ADA is 'an analog of the average or mean deviation'. The formula for the ADA is: $$1 - \frac{\sum_{i=1}^k \left| f_i - \frac{N}{K}\right|}{2 \frac{N}{K}(K-1)}$$
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.
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) ADA(x)#> [1] 0.9066667df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, ADA)#> [1] 0.8266667 0.9333333 0.8533333 0.9466667 0.9066667 0.8800000 0.8533333 #> [8] 0.9066667 0.8933333 0.9466667