*! version 1.0 13feb2016

Title

vratio -- Variation ratio and proportion of maximum heterogeneity (measures of dispersion) for categorical variables.

Syntax

vratio
varlist

Description

vratio calculates dispersion for categorical variables at the nominal/ordinal level of measurement.
Quantities calculated include the variation ratio (VR), maximum variation ratio (VRmax), and proportion of maximum heterogeneity (VR/VRmax).
VR is the proportion of observations not in the modal category.
VRmax is the maximum heterogeneity or, in other words, the maximum value VR could take if all categories had the same number of observations.
VR/VRmax is the proportion of maximum possible heterogeneity.
Higher VR and VR/VRmax values indicate greater dispersion.
k is also reported, which is simply the number of categories for categorical variables.
Please note that k itself (but not VR, VRmax, and VR/VRmax) might be useful in some applications with interval/ratio variables as it would indicate the number of unique scores in a distribution.

Formulas

VR = 1-(Fm/n)
VRmax = 1-((n/k)/n)

Fm-frequency of modal category; n-number of observations; k-number of categories

Examples

preserve
sysuse auto, clear
tab1 rep78 foreign
vratio rep78 foreign
return list
restore

Stored Results

Matrices
r(vr)	variation ratio
r(vrmax)	maximum variation ratio
r(pmh)	proportion of maximum heterogeneity
r(k) number of categories

Required Ado File

The vratio command uses the mmodes command created by: Adrian Mander, MRC Human Nutrition Research, Cambridge, UK.

Citation

Ward, J.T. (2016). vratio: Stata module to calculate variation ratio and proportion of maximum heterogeneity for categorical variables.

Author

Jeffrey T. Ward, Ph.D., Temple University, Department of Criminal Justice (professorward@temple.edu).