powered by
Computes dominance for a nominal variable using the Simpson index, quantifying the degree to which a few categories dominate the distribution.
dominance_index(df, var)
A numeric value representing dominance.
A data.frame or tibble containing the nominal variable.
Character. Name of the nominal variable in df.
df
Dominance is calculated as: $$D = \sum p_i^2$$ where \(p_i\) is the relative frequency of category \(i\).
Higher values indicate stronger dominance by fewer categories.
dominance_index(categories, "animal") dominance_index(categories2, "animal") dominance_index(categories3, "animal")
Run the code above in your browser using DataLab