I calculate the input to a box and whisker diagram like this (data is a sorted integer array), and LQ, UQ are the lower resp. upper quantile:

    Min:    data[0],
    LQ:     data[len(data)/4],
    Median: data[len(data)/2],
    UQ:     data[len(data)/4*3],
    Max:    data[len(data)-1],

My question would be: Is there a mathematical definition / algorithm to define how 'compact' such an array of integers is? If Max-Min = 0 it's super compact, but what would a sane definition of compactness / heterogeneity be if I compare two such arrays and for both holds Max - Min != 0 ?

Normal distribution of data is assumed!


You can use the coefficient of variation (CV) to compare the homogeneity/ variability between two data sets. The CV is given by $$CV=\frac{s}{\bar{x}}$$ where $s$ denotes the standard deviation of the sample and $\bar{x}$ the mean of the sample. The $CV$ is measured in percent units, which is means that is a number (free of specific measurement units) and can be used for comparison between different data sets. Sets with values of CV less than $10\%$ tend to be interpreted as homogenous sets.

In the example you mention, i.e. when $\max -\min=0$ then the CV will also be zero and that is also the only case in which the CV will be zero.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.