Title: | Implements Indices of Qualitative Variation Proposed by Wilcox (1973) |
---|---|
Description: | Implements indices of qualitative variation proposed by Wilcox (1973). |
Authors: | Joel Gombin [aut, cre] |
Maintainer: | Joel Gombin <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2025-03-15 03:11:33 UTC |
Source: | https://github.com/joelgombin/qualvar |
Computes the average deviation analog (ADA) for a vector of frequencies of categories.
ADA(x, na.rm = TRUE)
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. |
According to Wilcox (1973, p. 328), the ADA is 'an analog of the average or mean deviation'. The formula for the ADA is:
The value of the ADA statistics, which is normalised (varies between 0 and 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) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, ADA)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) ADA(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, ADA)
Computes the B index for a vector of frequencies of categories.
B(x, na.rm = TRUE)
B(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. |
According to Wilcox (1973, p. 330), and following Kaiser (1968), the B index relies on the geometric mean, but corrects it for undesirable properties. The formula for the B index is:
The value of the B statistics, which is normalised (varies between 0 and 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. Kaiser, Henry F. 'A Measure of the Population Quality of Legislative Apportionment.' The American Political Science Review 62, no. 1 (March 1968): 208. doi:10.2307/1953335.
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) B(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, B)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) B(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, B)
Computes the deviation from the mode for a vector of frequencies of categories.
DM(x, na.rm = TRUE)
DM(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. |
According to Wilcox (1973, p. 327), 'the measure can be thought of as an index of deviation from the modal frequency, analogous to the variance as a measure of deviation from the mean'. The formula for the DM is:
The value of the DM statistics, which is normalised (varies between 0 and 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)) names(x) <- c("a", "b", "c", "d") DM(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) names(df) <- c("a", "b", "c", "d") apply(df, 1, DM)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) names(x) <- c("a", "b", "c", "d") DM(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) names(df) <- c("a", "b", "c", "d") apply(df, 1, DM)
Computes the HREL index for a vector of frequencies of categories.
HREL(x, na.rm = TRUE)
HREL(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. |
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 of the 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:
The value of the HREL statistics, which is normalised (varies between 0 and 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. Senders, Virginia L. Measurement and Statistics. New York: Oxford University Press, 1958.
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) HREL(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, HREL)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) HREL(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, HREL)
Computes the mean difference analog (MDA or MNDIF) for a vector of frequencies of categories.
MDA(x, na.rm = TRUE)
MDA(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. |
According to Wilcox (1973, p. 328), the MDA is 'an analog of the mean difference, a measure of variation that is discussed and used much less frequently than the average deviation or the standard deviation. It is defined as "the average of the differences of all the possible pairs of variate-values, taken regardless of sign"'. The formula for the MDA is:
The value of the MDA statistics, which is normalised (varies between 0 and 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)) MDA(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, MDA)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) MDA(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, MDA)
Computes the variance analog (VA) for a vector of frequencies of categories.
VA(x, na.rm = TRUE)
VA(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. |
According to Wilcox (1973, p. 329), the VA is 'based on the variance, which is defined as the arithmetic mean of the squared differences of each value from the mean'. The formula for the VA is:
The value of the VA statistics, which is normalised (varies between 0 and 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)) VA(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, VA)
x <- rmultinom(1, 100, rep_len(0.25, 4)) x <- as.vector(t(x)) VA(x) df <- rmultinom(10, 100, rep_len(0.25, 4)) df <- as.data.frame(t(df)) apply(df, 1, VA)
A dataset containing the returns of the 1968 US presidential election, by states.
wilcox1973
wilcox1973
a data_frame
with 52 rows and 4 variables.
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.