• Descriptive
    • Moments
    • Concentration
    • Central Tendency
    • Variability
    • Stem-and-Leaf Plot
    • Histogram & Frequency Table
    • Data Quality Forensics
    • Conditional EDA
    • Quantiles
    • Kernel Density Estimation
    • Normal QQ Plot
    • Bootstrap Plot

    • Multivariate Descriptive Statistics
  • Distributions
    • Binomial Probabilities
    • Geometric Probabilities
    • Negative Binomial Probabilities
    • Hypergeometric Probabilities
    • Multinomial Probabilities
    • Poisson Probabilities

    • Exponential
    • Gamma
    • Erlang
    • Weibull
    • Rayleigh
    • Lognormal
    • Pareto
    • Inverse Gamma

    • Beta
    • Power
    • Beta Prime (Inv. Beta)
    • Triangular

    • Normal (area)
    • Logistic
    • Laplace
    • Cauchy (standard)
    • Cauchy (location-scale)
    • Gumbel

    • Normal RNG
    • ML Fitting
    • Tukey Lambda PPCC
    • Box-Cox Normality Plot
    • Sample Correlation r

    • Empirical Tests
  • Hypotheses
    • Theoretical Aspects of Hypothesis Testing
    • Bayesian Inference
    • Minimum Sample Size

    • Empirical Tests
    • Multivariate (pair-wise) Testing
  • Models
    • Manual Model Building
  • Time Series
    • Time Series Plot
    • Decomposition
    • Exponential Smoothing

    • Blocked Bootstrap Plot
    • Mean Plot
    • (P)ACF
    • VRM
    • Standard Deviation-Mean Plot
    • Spectral Analysis
    • ARIMA

    • Cross Correlation Function
    • Granger Causality
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 66  Variability
  • Preface
  • Getting Started
    • 1  Introduction
    • 2  Why Do We Need Innovative Technology?
    • 3  Basic Definitions
    • 4  The Big Picture: Why We Analyze Data
  • Introduction to Probability
    • 5  Definitions of Probability
    • 6  Jeffreys’ axiom system
    • 7  Bayes’ Theorem
    • 8  Sensitivity and Specificity
    • 9  Naive Bayes Classifier
    • 10  Law of Large Numbers

    • 11  Problems
  • Probability Distributions
    • 12  Bernoulli Distribution
    • 13  Binomial Distribution
    • 14  Geometric Distribution
    • 15  Negative Binomial Distribution
    • 16  Hypergeometric Distribution
    • 17  Multinomial Distribution
    • 18  Poisson Distribution

    • 19  Uniform Distribution (Rectangular Distribution)
    • 20  Normal Distribution (Gaussian Distribution)
    • 21  Gaussian Naive Bayes Classifier
    • 22  Chi Distribution
    • 23  Chi-squared Distribution (1 parameter)
    • 24  Chi-squared Distribution (2 parameters)
    • 25  Student t-Distribution
    • 26  Fisher F-Distribution
    • 27  Exponential Distribution
    • 28  Lognormal Distribution
    • 29  Gamma Distribution
    • 30  Beta Distribution
    • 31  Weibull Distribution
    • 32  Pareto Distribution
    • 33  Inverse Gamma Distribution
    • 34  Rayleigh Distribution
    • 35  Erlang Distribution
    • 36  Logistic Distribution
    • 37  Laplace Distribution
    • 38  Gumbel Distribution
    • 39  Cauchy Distribution
    • 40  Triangular Distribution
    • 41  Power Distribution
    • 42  Beta Prime Distribution
    • 43  Sample Correlation Distribution
    • 44  Dirichlet Distribution
    • 45  Generalized Extreme Value (GEV) Distribution
    • 46  Frechet Distribution
    • 47  Noncentral t Distribution
    • 48  Noncentral F Distribution
    • 49  Inverse Chi-Squared Distribution
    • 50  Maxwell-Boltzmann Distribution
    • 51  Distribution Relationship Map

    • 52  Problems
  • Descriptive Statistics & Exploratory Data Analysis
    • 53  Types of Data
    • 54  Datasheets

    • 55  Frequency Plot (Bar Plot)
    • 56  Frequency Table
    • 57  Contingency Table
    • 58  Binomial Classification Metrics
    • 59  Confusion Matrix
    • 60  ROC Analysis

    • 61  Stem-and-Leaf Plot
    • 62  Histogram
    • 63  Data Quality Forensics
    • 64  Quantiles
    • 65  Central Tendency
    • 66  Variability
    • 67  Skewness & Kurtosis
    • 68  Concentration
    • 69  Notched Boxplot
    • 70  Scatterplot
    • 71  Pearson Correlation
    • 72  Rank Correlation
    • 73  Partial Pearson Correlation
    • 74  Simple Linear Regression
    • 75  Moments
    • 76  Quantile-Quantile Plot (QQ Plot)
    • 77  Normal Probability Plot
    • 78  Probability Plot Correlation Coefficient Plot (PPCC Plot)
    • 79  Box-Cox Normality Plot
    • 80  Kernel Density Estimation
    • 81  Bivariate Kernel Density Plot
    • 82  Conditional EDA: Panel Diagnostics
    • 83  Bootstrap Plot (Central Tendency)
    • 84  Survey Scores Rank Order Comparison
    • 85  Cronbach Alpha

    • 86  Equi-distant Time Series
    • 87  Time Series Plot (Run Sequence Plot)
    • 88  Mean Plot
    • 89  Blocked Bootstrap Plot (Central Tendency)
    • 90  Standard Deviation-Mean Plot
    • 91  Variance Reduction Matrix
    • 92  (Partial) Autocorrelation Function
    • 93  Periodogram & Cumulative Periodogram

    • 94  Problems
  • Hypothesis Testing
    • 95  Normal Distributions revisited
    • 96  The Population
    • 97  The Sample
    • 98  The One-Sided Hypothesis Test
    • 99  The Two-Sided Hypothesis Test
    • 100  When to use a one-sided or two-sided test?
    • 101  What if \(\sigma\) is unknown?
    • 102  The Central Limit Theorem (revisited)
    • 103  Statistical Test of the Population Mean with known Variance
    • 104  Statistical Test of the Population Mean with unknown Variance
    • 105  Statistical Test of the Variance
    • 106  Statistical Test of the Population Proportion
    • 107  Statistical Test of the Standard Deviation \(\sigma\)
    • 108  Statistical Test of the difference between Means -- Independent/Unpaired Samples
    • 109  Statistical Test of the difference between Means -- Dependent/Paired Samples
    • 110  Statistical Test of the difference between Variances -- Independent/Unpaired Samples

    • 111  Hypothesis Testing for Research Purposes
    • 112  Decision Thresholds, Alpha, and Confidence Levels
    • 113  Bayesian Inference for Decision-Making
    • 114  One Sample t-Test
    • 115  Skewness & Kurtosis Tests
    • 116  Paired Two Sample t-Test
    • 117  Wilcoxon Signed-Rank Test
    • 118  Unpaired Two Sample t-Test
    • 119  Unpaired Two Sample Welch Test
    • 120  Two One-Sided Tests (TOST) for Equivalence
    • 121  Mann-Whitney U test (Wilcoxon Rank-Sum Test)
    • 122  Bayesian Two Sample Test
    • 123  Median Test based on Notched Boxplots
    • 124  Chi-Squared Tests for Count Data
    • 125  Kolmogorov-Smirnov Test
    • 126  One Way Analysis of Variance (1-way ANOVA)
    • 127  Kruskal-Wallis Test
    • 128  Two Way Analysis of Variance (2-way ANOVA)
    • 129  Repeated Measures ANOVA
    • 130  Friedman Test
    • 131  Testing Correlations
    • 132  A Note on Causality

    • 133  Problems
  • Regression Models
    • 134  Simple Linear Regression Model (SLRM)
    • 135  Multiple Linear Regression Model (MLRM)
    • 136  Logistic Regression
    • 137  Generalized Linear Models
    • 138  Multinomial and Ordinal Logistic Regression
    • 139  Cox Proportional Hazards Regression
    • 140  Conditional Inference Trees
    • 141  Leaf Diagnostics for Conditional Inference Trees
    • 142  Hypothesis Testing with Linear Regression Models (from a Practical Point of View)

    • 143  Problems
  • Introduction to Time Series Analysis
    • 144  Case: the Market of Health and Personal Care Products
    • 145  Decomposition of Time Series
    • 146  Ad hoc Forecasting of Time Series
  • Box-Jenkins Analysis
    • 147  Introduction to Box-Jenkins Analysis
    • 148  Theoretical Concepts
    • 149  Stationarity
    • 150  Identifying ARMA parameters
    • 151  Estimating ARMA Parameters and Residual Diagnostics
    • 152  Forecasting with ARIMA models
    • 153  Intervention Analysis
    • 154  Cross-Correlation Function
    • 155  Transfer Function Noise Models
    • 156  General-to-Specific Modeling
  • References
  • Appendices
    • Appendices
    • A  Method Selection Guide
    • B  Presentations and Teaching Materials
    • C  R Language Concepts for Statistical Computing
    • D  Matrix Algebra
    • E  Standard Normal Table (Gaussian Table)
    • F  Critical values of Student’s \(t\) distribution with \(\nu\) degrees of freedom
    • G  Upper-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom
    • H  Lower-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom

Table of contents

  • 66.1 How to Use This Chapter
  • 66.2 Absolute Range
    • 66.2.1 Definition
  • 66.3 Relative Range (biased)
    • 66.3.1 Definition
  • 66.4 Relative Range (\(n-1\) denominator)
    • 66.4.1 Definition
  • 66.5 Variance (biased)
    • 66.5.1 Definition
    • 66.5.2 Alternative Formulations
    • 66.5.3 Property 1
    • 66.5.4 Property 2
    • 66.5.5 Property 3
  • 66.6 Variance (unbiased)
    • 66.6.1 Definition
  • 66.7 Standard Deviation (biased)
    • 66.7.1 Definition
  • 66.8 Standard Deviation (\(n-1\) denominator)
    • 66.8.1 Definition
  • 66.9 Coefficient of Relative Variation (biased)
    • 66.9.1 Definition
  • 66.10 Coefficient of Relative Variation (\(n-1\) denominator)
    • 66.10.1 Definition
  • 66.11 Squared Coefficient of Relative Variation
    • 66.11.1 Definition
  • 66.12 Mean Squared Error (MSE)
    • 66.12.1 Definition
    • 66.12.2 Property
  • 66.13 Mean Absolute Deviation from the Mean (MAD)
    • 66.13.1 Definition
    • 66.13.2 Property
  • 66.14 Mean Absolute Deviation from the Median
    • 66.14.1 Definition
  • 66.15 Median Absolute Deviation from the Mean
    • 66.15.1 Definition
  • 66.16 Median Absolute Deviation from the Median
    • 66.16.1 Definition
  • 66.17 Interquartile Difference (Interquartile Range)
    • 66.17.1 Definition
  • 66.18 Quartile Deviation - Semi Interquartile Range - Quartile Range
    • 66.18.1 Definition
  • 66.19 Coefficient of Quartile Variation
    • 66.19.1 Definition
  • 66.20 Number of all Pairs of Observations
    • 66.20.1 Definition
  • 66.21 Squared Differences between all Pairs of Observations
    • 66.21.1 Definition
    • 66.21.2 Property
  • 66.22 Mean Absolute Differences between all Pairs of Observations
    • 66.22.1 Definition
  • 66.23 Gini’s Mean Difference (Gini 1912)
    • 66.23.1 Definition
  • 66.24 Leik’s Measure of Dispersion (Leik 1966)
    • 66.24.1 Definition
  • 66.25 Coefficient of Dispersion
    • 66.25.1 Definition
  • 66.26 Index of Diversity (Simpson 1949)
    • 66.26.1 Definition
  • 66.27 Index of Qualitative Variation
    • 66.27.1 Definition
  • 66.28 Mean Squared Deviation from the Mean
    • 66.28.1 Definition
  • 66.29 Mean Squared Deviation from the Median
    • 66.29.1 Definition
  • 66.30 Relationship between MAD, QD, and s
    • 66.30.1 Relationship 1
    • 66.30.2 Relationship 2
  • 66.31 R Module
    • 66.31.1 Public website
    • 66.31.2 RFC
  • 66.32 Purpose of Variability in general
DRAFT This draft is under development — DO NOT CITE OR SHARE.
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 66  Variability

66  Variability

66.1 How to Use This Chapter

This chapter lists several variability measures because different analyses need different robustness and scale properties.

  • Use Variance/Standard Deviation when means and squared-error loss are central.
  • Use IQR or MAD-type measures when robustness to outliers matters.
  • Use Coefficient of Variation when comparing spread across variables with different units or magnitudes.

66.2 Absolute Range

66.2.1 Definition

If the observations are sorted in ascending order then

\[ Range = x_{max} - x_{min} = x_n - x_1 \]

66.3 Relative Range (biased)

66.3.1 Definition

\[ Range = \frac{x_{max} - x_{min}}{s_x} \]

where

\[ s_x = \sqrt{\frac{1}{n} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.4 Relative Range (\(n-1\) denominator)

66.4.1 Definition

\[ Range = \frac{x_{max} - x_{min}}{s_x} \]

where

\[ s_x = \sqrt{\frac{1}{n-1} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.5 Variance (biased)

66.5.1 Definition

\[ V(x) = s_x^2 = \frac{1}{n} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.5.2 Alternative Formulations

\[ \begin{align*} & V(x) = \frac{1}{n} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 \\ & V(x) = \frac{1}{n} \sum_{i=1}^{n} \left( x_i^2 - 2 \bar{x} x_i + \bar{x}^2 \right) \\ & V(x) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 - 2 \bar{x} \frac{1}{n} \sum_{i=1}^{n} x_i + \frac{1}{n} n \bar{x}^2 \\ & V(x) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 - 2 \bar{x} \bar{x} + \bar{x}^2 \\ & V(x) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 - \bar{x}^2 \\ & V(x) = \left( \frac{1}{n} \sum_{i=1}^{n} x_i^2 \right) - \left( \frac{1}{n} \sum_{i=1}^{n} x_i \right)^2 \\ & V(x) = \left( Mean \, of \, Squares \right) - \left( Square \, of \, Mean \right) \end{align*} \]

66.5.3 Property 1

The first property holds for any real number a

\[ \begin{align*} & V(a) = \frac{1}{n} \sum_{i=1}^{n} a^2 - \left( \frac{1}{n} \sum_{i=1}^{n} a \right)^2 \\ & V(a) = \frac{1}{n} n a^2 - \left( \frac{1}{n} n a \right)^2 \\ & V(a) = a^2 - a^2 = 0 \end{align*} \]

66.5.4 Property 2

\[ \begin{align*} & V(x+a) = \frac{1}{n} \sum_{i=1}^n \left( x_i + a \right)^2 - \left( \frac{1}{n} \sum_{i=1}^n \left( x_i + a \right) \right)^2 \\ & V(x+a) = \frac{1}{n} \sum_{i=1}^{n} \left( x_i^2 + 2ax_i + a^2 \right) - \left( \bar{x} + a \right)^2 \\ & V(x+a) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 + \frac{2a}{n} \sum_{i=1}^{n} x_i + \frac{1}{n} n a^2 - \bar{x}^2 - a^2 - 2a\bar{x} \\ & V(x+a) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 + 2 a \bar{x} + a^2 - \bar{x}^2 - a^2 - 2a\bar{x} \\ & V(x+a) = \frac{1}{n} \sum_{i=1}^{n} x_i^2 - \bar{x}^2 = V(x) \end{align*} \]

66.5.5 Property 3

\[ \begin{align*} & V(ax) = \frac{1}{n} \sum_{i=1}^n \left( a x_i \right)^2 - \left( \frac{1}{n} \sum_{i=1}^n \left( a x_i \right) \right)^2 \\ & V(ax) = \frac{a^2}{n} \sum_{i=1}^n x_i^2 - \left( a \bar{x} \right)^2 \\ & V(ax) = \frac{a^2}{n} \sum_{i=1}^n x_i^2 - a^2\bar{x}^2 \\ & V(ax) = a^2 \left( \frac{1}{n} \sum_{i=1}^n x_i^2 - \bar{x}^2 \right) = a^2 V(x) \end{align*} \]

66.6 Variance (unbiased)

66.6.1 Definition

\[ V(x) = s_x^2 = \frac{1}{n-1} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.7 Standard Deviation (biased)

66.7.1 Definition

\[ s_x = \sqrt{V(x)} = \sqrt{ \frac{1}{n} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.8 Standard Deviation (\(n-1\) denominator)

66.8.1 Definition

\[ s_x = \sqrt{V(x)} = \sqrt{ \frac{1}{n-1} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2. Also note that it can be shown that the square root of the sample variance underestimates the true standard deviation (this is because the square root is a nonlinear function). In other words, the standard deviation computed from the sample variance with denominator \(n-1\) is, in fact, still biased. For practical purposes, this (rather small) bias is ignored.

66.9 Coefficient of Relative Variation (biased)

66.9.1 Definition

The Coefficient of Variation is defined for any Arithmetic mean \(\bar{x} \neq 0\)

\[ CV =\frac{s_x}{\bar{x}} \]

\[ CV =\frac{ \sqrt{\frac{1}{n} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } }{ \frac{1}{n} \sum_{i=1}^n x_i } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.10 Coefficient of Relative Variation (\(n-1\) denominator)

66.10.1 Definition

The Coefficient of Variation is defined for any Arithmetic mean \(\bar{x} \neq 0\)

\[ CV =\frac{s_x}{\bar{x}} \]

\[ CV =\frac{ \sqrt{\frac{1}{n-1} \sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2 } }{ \frac{1}{n} \sum_{i=1}^n x_i } \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.11 Squared Coefficient of Relative Variation

66.11.1 Definition

The Squared Coefficient of Variation is defined for any Arithmetic mean \(\bar{x} \neq 0\)

\[ CV^2 =\frac{s_x^2}{\bar{x}^2} = \frac{V(x)}{\bar{x}^2} = \frac{1}{n} \sum_{i=1}^n \left( \frac{x_i -\bar{x} }{\bar{x}} \right)^2 \]

or

\[ CV^2 =\frac{\frac{1}{n} \sum_{i=1}^n \left( x_i - \bar{x} \right)^2 }{\bar{x}^2} = \frac{\sum_{i=1}^n \left( \frac{x_i - \bar{x} }{\bar{x} } \right)^2 }{n} = \frac{1}{n} \sum_{i=1}^n \left( \frac{x_i -\bar{x} }{\bar{x}} \right)^2 \]

Note: \(\bar{x}\) is the Arithmetic Mean as defined in Section 65.2.

66.12 Mean Squared Error (MSE)

66.12.1 Definition

For any real number a, the MSE is defined as follows

\[ MSE = \frac{1}{n} \sum_{i=1}^{n} \left( x_i - a \right)^2 \]

66.12.2 Property

There is a relationship between MSE and the Variance. If \(a = \bar{x}\) then the MSE is equal to the (biased) variance.

\[ \begin{align*} & MSE = \frac{1}{n} \sum_{i=1}^{n} \left( x_i -\bar{x} + \bar{x} - a \right)^2 \\ & MSE = \frac{1}{n} \sum_{i=1}^{n} \left( \left( x_i -\bar{x} \right)^2 + 2 \left( \left( x_i - \bar{x} \right) \left( \bar{x} - a \right) \right) + \left( \bar{x} - a \right)^2 \right) \\ & MSE = \frac{1}{n} \sum_{i=1}^n \left( x_i - \bar{x} \right) ^2 + \left( \bar{x} - a \right)^2 \\ & MSE = V(x) + b \end{align*} \]

where \(b = \left( \bar{x} - a \right)^2\). The MSE is minimal and equal to the (biased) variance if \(b=0\). This minimum can only be reached if \(a\) is equal to the arithmetic mean.

66.13 Mean Absolute Deviation from the Mean (MAD)

66.13.1 Definition

\[ MAD = \frac{1}{n} \sum_{i=1}^n \left\| x_i - \bar{x} \right\| \]

Note: by default the MAD is computed against the mean. In general, however, the MAD could be computed against any measure of central tendency (such as the mean, median, geometric mean, winsorized mean, trimmed mean, etc.). To avoid confusion it is best to explicitly state the measure of central tendency that is used.

Alternative notation:

\[ MAD = Aver \left\| x - Aver(x) \right\| = \frac{1}{n} \sum_{i=1}^n \left\| x_i - \bar{x} \right\| \]

where Aver() is the mathematical function that computes the average (arithmetic mean) of the variable (in the R language we would use the function mean).

66.13.2 Property

The Mean Absolute Deviation is bound between a minimum and a maximum:

\[ \frac{x_{max} - x_{min}}{n} \leq MAD \leq \frac{x_{max} - x_{min}}{2} \]

66.14 Mean Absolute Deviation from the Median

66.14.1 Definition

\[ MADMed = Aver \left\| x - Med(x) \right\| = \frac{1}{n} \sum_{i=1}^n \left\| x_i - Med(x) \right\| \]

where Aver() and Med() are the mathematical functions that compute the arithmetic mean and median of the variable (in the R language we would use mean and median).

66.15 Median Absolute Deviation from the Mean

66.15.1 Definition

\[ MedAD = Med \left\| x - Aver(x) \right\| = Med \left\| x - \bar{x} \right\| \]

where Aver() and Med() are the functions that compute the average (arithmetic mean) and median of the variable.

66.16 Median Absolute Deviation from the Median

66.16.1 Definition

\[ MedADMed = Med \left\| x - Med(x) \right\| \]

where Med() is the function that computes the median of the variable.

66.17 Interquartile Difference (Interquartile Range)

66.17.1 Definition

\[ IQD = IQR = Q_3 - Q_1 \]

where \(Q_3 = Quantile(0.75)\) and \(Q_1 = Quantile(0.25)\) as defined in Chapter 64.

66.18 Quartile Deviation - Semi Interquartile Range - Quartile Range

66.18.1 Definition

\[ QD = \frac{Q_3 - Q_1}{2} \]

where \(Q_3 = Quantile(0.75)\) and \(Q_1 = Quantile(0.25)\) as defined in Chapter 64.

66.19 Coefficient of Quartile Variation

66.19.1 Definition

\[ CQV = \frac{Q_3 - Q_1}{Q_3 + Q_1} \]

where \(Q_3 = Quantile(0.75)\) and \(Q_1 = Quantile(0.25)\) as defined in Chapter 64.

66.20 Number of all Pairs of Observations

66.20.1 Definition

\[ \binom{n}{2} = \frac{n!}{2!(n-2)!} = \frac{1\*2\*...\*(n-2)(n-1)n}{(1\*2)(1\*2\*...\*(n-3)(n-2)} = \frac{n(n-1)}{2} \]

66.21 Squared Differences between all Pairs of Observations

66.21.1 Definition

For all \(i,j = 1,2,…,n\) and \(i < j\):

\[ \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left( x_i - x_j \right)^2 }{\binom{n}{2}} = \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left( x_i - x_j \right)^2 }{\frac{n(n-1)}{2}}\]

66.21.2 Property

\[ \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left( x_i - x_j \right)^2 }{\binom{n}{2}} = \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left( x_i - x_j \right)^2 }{\frac{n(n-1)}{2}} = \frac{2n s_{x}^2}{n-1} \]

\[ \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left( x_i - x_j \right)^2 }{n^2} = V(x) \]

Note: the proof is beyond the scope of this book.

66.22 Mean Absolute Differences between all Pairs of Observations

66.22.1 Definition

For all \(i,j = 1,2,…,n\) and \(i \neq j\):

\[ \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left\| x_i - x_j \right\| }{\binom{n}{2}} = \frac{\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \left\| x_i - x_j \right\| }{\frac{n(n-1)}{2}}\]

66.23 Gini’s Mean Difference (Gini 1912)

66.23.1 Definition

For all \(i,j = 1,2,…,n\) and \(i \neq j\):

\[ GMD = \frac{\sum_{i=1}^{n} \sum_{j=1}^{n} \left\| x_i - x_j \right\| }{n(n-1)} \]

66.24 Leik’s Measure of Dispersion (Leik 1966)

66.24.1 Definition

\[ D = 2 \sum_{k=1}^{K} \frac{d_k}{K-1} = \frac{2}{K-1} \sum_{k=1}^K d_k \]

where

\[ \forall k=1,2,...,K : p_k = \frac{x_k}{\sum_{j=1}^K x_j} \]

\[ \forall k=1,2,...,K : c_k = \sum_{j=1}^k p_j \]

\[ c_k \leq 0.5 \Rightarrow d_k = c_k \]

\[ c_k > 0.5 \Rightarrow d_k = 1 - c_k \]

66.25 Coefficient of Dispersion

66.25.1 Definition

\[ CD = \frac{MAD}{Med(x)} = \frac{1}{n} \sum_{i=1}^{n} \left\| \frac{x_i - Med(x)}{Med(x)} \right\| \]

where Med() is the function that computes the median of the variable.

66.26 Index of Diversity (Simpson 1949)

66.26.1 Definition

\[ ID = 1 - p_1^2 - p_2^2 - ... - p_K^2 = 1 - \sum_{k=1}^K p_k^2 \]

where

\[ p_k = \frac{x_k}{\sum_{j=1}^{K} x_j} \]

Note: \(0 \leq D \leq \frac{K-1}{K}\).

66.27 Index of Qualitative Variation

66.27.1 Definition

\[ IQV = \frac{ID}{\frac{K-1}{K}} = \frac{K}{K-1} \left( 1 - \sum_{k=1}^K p_k^2 \right) \]

where

\[ ID = 1 - p_1^2 - p_2^2 - ... - p_K^2 = 1 - \sum_{k=1}^K p_k^2 \]

\[ \frac{1 - \sum_{k=1}^K p_k^2}{\frac{K-1}{K}} = \frac{K}{K-1} \left( 1 - \sum_{k=1}^K p_k^2 \right) \]

\[ p_k = \frac{x_k}{\sum_{j=1}^{K} x_j} \]

Note: \(0 \leq IQV \leq 1\).

66.28 Mean Squared Deviation from the Mean

66.28.1 Definition

\[ MSD = Aver \left( x - Aver(x) \right)^2 = Aver \left( x - \bar{x} \right)^2 = \frac{1}{n} \sum_{i=1}^n \left( x_i - \bar{x} \right)^2 \]

where Aver() is the function that computes the average (Arithmetic Mean) of the variable.

66.29 Mean Squared Deviation from the Median

66.29.1 Definition

\[ MSDMed = Aver \left( x - Med(x) \right)^2 = \frac{1}{n} \sum_{i=1}^n \left( x_i - Med(x) \right)^2 \]

where Aver() and Med() are the functions that compute the arithmetic mean and median of the variable.

66.30 Relationship between MAD, QD, and s

66.30.1 Relationship 1

If the data are unimodal and (reasonably) symmetric then

\[ MAD \approx \frac{4}{5} s \]

\[ QD \approx \frac{2}{3} s \]

66.30.2 Relationship 2

For a normal distribution the following relationships hold

\[ MAD = 0.7979 s \]

\[ QD = 0.6745 s \]

66.31 R Module

66.31.1 Public website

The Variability module can be found on the public website:

  • https://compute.wessa.net/varia.wasp

66.31.2 RFC

The Variability module is available in RFC under the menu item “Descriptive / Variability”.

If you prefer to compute the measures of Variability on your local machine, the following script can be used in the R console:

x <- rnorm(150)

q1 <- function(data,n,p,i,f) {
  np <- n*p;
  i <<- floor(np)
  f <<- np - i
  qvalue <- (1-f)*data[i] + f*data[i+1]
}
q2 <- function(data,n,p,i,f) {
  np <- (n+1)*p
  i <<- floor(np)
  f <<- np - i
  qvalue <- (1-f)*data[i] + f*data[i+1]
}
q3 <- function(data,n,p,i,f) {
  np <- n*p
  i <<- floor(np)
  f <<- np - i
  if (f==0) {
    qvalue <- data[i]
  } else {
    qvalue <- data[i+1]
  }
}
q4 <- function(data,n,p,i,f) {
  np <- n*p
  i <<- floor(np)
  f <<- np - i
  if (f==0) {
    qvalue <- (data[i]+data[i+1])/2
  } else {
    qvalue <- data[i+1]
  }
}
q5 <- function(data,n,p,i,f) {
  np <- (n-1)*p
  i <<- floor(np)
  f <<- np - i
  if (f==0) {
    qvalue <- data[i+1]
  } else {
    qvalue <- data[i+1] + f*(data[i+2]-data[i+1])
  }
}
q6 <- function(data,n,p,i,f) {
  np <- n*p+0.5
  i <<- floor(np)
  f <<- np - i
  qvalue <- data[i]
}
q7 <- function(data,n,p,i,f) {
  np <- (n+1)*p
  i <<- floor(np)
  f <<- np - i
  if (f==0) {
    qvalue <- data[i]
  } else {
    qvalue <- (1-f)*data[i] + f*data[i+1]
  }
}
q8 <- function(data,n,p,i,f) {
  np <- (n+1)*p
  i <<- floor(np)
  f <<- np - i
  if (f==0) {
    qvalue <- data[i]
  } else {
    if (f == 0.5) {
      qvalue <- (data[i]+data[i+1])/2
    } else {
      if (f < 0.5) {
        qvalue <- data[i]
      } else {
        qvalue <- data[i+1]
      }
    }
  }
}
iqd <- function(x,def) {
  x <-sort(x[!is.na(x)])
  n<-length(x)
  if (def==1) {
    qvalue1 <- q1(x,n,0.25,i,f)
    qvalue3 <- q1(x,n,0.75,i,f)
  }
  if (def==2) {
    qvalue1 <- q2(x,n,0.25,i,f)
    qvalue3 <- q2(x,n,0.75,i,f)
  }
  if (def==3) {
    qvalue1 <- q3(x,n,0.25,i,f)
    qvalue3 <- q3(x,n,0.75,i,f)
  }
  if (def==4) {
    qvalue1 <- q4(x,n,0.25,i,f)
    qvalue3 <- q4(x,n,0.75,i,f)
  }
  if (def==5) {
    qvalue1 <- q5(x,n,0.25,i,f)
    qvalue3 <- q5(x,n,0.75,i,f)
  }
  if (def==6) {
    qvalue1 <- q6(x,n,0.25,i,f)
    qvalue3 <- q6(x,n,0.75,i,f)
  }
  if (def==7) {
    qvalue1 <- q7(x,n,0.25,i,f)
    qvalue3 <- q7(x,n,0.75,i,f)
  }
  if (def==8) {
    qvalue1 <- q8(x,n,0.25,i,f)
    qvalue3 <- q8(x,n,0.75,i,f)
  }
  iqdiff <- qvalue3 - qvalue1
  return(c(iqdiff,iqdiff/2,iqdiff/(qvalue3 + qvalue1)))
}

num <- 50
res <- array(NA,dim=c(num,2))
range <- max(x) - min(x)
lx <- length(x)
biasf <- (lx-1)/lx
varx <- var(x)
bvarx <- varx*biasf
sdx <- sqrt(varx)
mx <- mean(x)
bsdx <- sqrt(bvarx)
x2 <- x*x
mse0 <- sum(x2)/lx
xmm <- x-mx
xmm2 <- xmm*xmm
msem <- sum(xmm2)/lx
axmm <- abs(x - mx)
medx <- median(x)
axmmed <- abs(x - medx)
xmmed <- x - medx
xmmed2 <- xmmed*xmmed
msemed <- sum(xmmed2)/lx
qarr <- array(NA,dim=c(8,3))
for (j in 1:8) {
  qarr[j,] <- iqd(x,j)
}
sdpo <- 0
adpo <- 0
for (i in 1:(lx-1)) {
  for (j in (i+1):lx) {
    ldi <- x[i]-x[j]
    aldi <- abs(ldi)
    sdpo = sdpo + ldi * ldi
    adpo = adpo + aldi
  }
}
denom <- (lx*(lx-1)/2)
sdpo = sdpo / denom
adpo = adpo / denom
gmd <- 0
for (i in 1:lx) {
  for (j in 1:lx) {
    ldi <- abs(x[i]-x[j])
    gmd = gmd + ldi
  }
}
gmd <- gmd / (lx*(lx-1))
cat_counts <- c(18, 24, 15, 27, 21, 19, 12, 14)
kcat <- length(cat_counts)
sumx <- sum(cat_counts)
pk <- cat_counts / sumx
ck <- cumsum(pk)
dk <- array(NA,dim=kcat)
for (i in 1:kcat) {
  if (ck[i] <= 0.5) dk[i] <- ck[i] else dk[i] <- 1 - ck[i]
}
bigd <- sum(dk) * 2 / (kcat-1)
iod <- 1 - sum(pk*pk)

df = data.frame(Statistic = c("Absolute range                                             ",
                              "Relative range (n-1 denominator)                           ",
                              "Relative range (biased)                                    ",
                              "Variance (unbiased)                                        ",
                              "Variance (biased)                                          ",
                              "Standard Deviation (n-1 denominator)                       ",
                              "Standard Deviation (biased)                                ",
                              "Coefficient of Variation (n-1 denominator)                 ",
                              "Coefficient of Variation (biased)                          ",
                              "Mean Squared Error (MSE versus 0)                          ",
                              "Mean Squared Error (MSE versus Mean)                       ",
                              "Mean Absolute Deviation from Mean (MAD Mean)               ",
                              "Mean Absolute Deviation from Median (MAD Median)           ",
                              "Median Absolute Deviation from Mean                        ",
                              "Median Absolute Deviation from Median                      ",
                              "Mean Squared Deviation from Mean                           ",
                              "Mean Squared Deviation from Median                         ",
                              "Interquartile Difference (Weighted Average at Xnp)         ",
                              "                     (Weighted Average at X(n+1)p)         ",
                              "                 (Empirical Distribution Function)         ",
                              "     (Empirical Distribution Function - Averaging)         ",
                              " (Empirical Distribution Function - Interpolation)         ",
                              "                             (Closest Observation)         ",
                              "        (True Basic - Statistics Graphics Toolkit)         ",
                              "                         (MS Excel (old versions))         ",
                              "Semi Interquartile Difference (Weighted Average at Xnp)    ",
                              "                          (Weighted Average at X(n+1)p)    ",
                              "                      (Empirical Distribution Function)    ",
                              "          (Empirical Distribution Function - Averaging)    ",
                              "      (Empirical Distribution Function - Interpolation)    ",
                              "                                  (Closest Observation)    ",
                              "             (True Basic - Statistics Graphics Toolkit)    ",
                              "                              (MS Excel (old versions))    ",
                              "Coefficient of Quartile Variation (Weighted Average at Xnp)",
                              "                              (Weighted Average at X(n+1)p)",
                              "                          (Empirical Distribution Function)",
                              "              (Empirical Distribution Function - Averaging)",
                              "          (Empirical Distribution Function - Interpolation)",
                              "                                      (Closest Observation)",
                              "                 (True Basic - Statistics Graphics Toolkit)",
                              "                                  (MS Excel (old versions))",
                              "Number of all Pairs of Observations                        ",
                              "Squared Differences between all Pairs of Observations      ",
                              "Mean Absolute Differences between all Pairs of Observations",
                              "Gini Mean Difference                                       ",
                              "Leik Measure of Dispersion                                 ",
                              "Index of Diversity                                         ",
                              "Index of Qualitative Variation                             ",
                              "Coefficient of Dispersion                                  ",
                              "Observations                                               "), 
                Value = c(range,
                          range/sd(x),
                          range/sqrt(varx*biasf),
                          varx,
                          bvarx,
                          sdx,
                          bsdx,
                          sdx/mx,
                          bsdx/mx,
                          mse0,
                          msem,
                          sum(axmm)/lx,
                          sum(axmmed)/lx,
                          median(axmm),
                          median(axmmed),
                          msem,
                          msemed,
                          qarr[1,1],
                          qarr[2,1],
                          qarr[3,1],
                          qarr[4,1],
                          qarr[5,1],
                          qarr[6,1],
                          qarr[7,1],
                          qarr[8,1],
                          qarr[1,2],
                          qarr[2,2],
                          qarr[3,2],
                          qarr[4,2],
                          qarr[5,2],
                          qarr[6,2],
                          qarr[7,2],
                          qarr[8,2],
                          qarr[1,3],
                          qarr[2,3],
                          qarr[3,3],
                          qarr[4,3],
                          qarr[5,3],
                          qarr[6,3],
                          qarr[7,3],
                          qarr[8,3],
                          lx*(lx-1)/2,
                          sdpo,
                          adpo,
                          gmd,
                          bigd,
                          iod,
                          iod*kcat/(kcat-1),
                          sum(axmmed)/lx/medx,
                          lx))

print(df)
                                                     Statistic         Value
1  Absolute range                                                  5.8745635
2  Relative range (n-1 denominator)                                6.0916876
3  Relative range (biased)                                         6.1120954
4  Variance (unbiased)                                             0.9299850
5  Variance (biased)                                               0.9237851
6  Standard Deviation (n-1 denominator)                            0.9643573
7  Standard Deviation (biased)                                     0.9611374
8  Coefficient of Variation (n-1 denominator)                    -12.5465629
9  Coefficient of Variation (biased)                             -12.5046711
10 Mean Squared Error (MSE versus 0)                               0.9296929
11 Mean Squared Error (MSE versus Mean)                            0.9237851
12 Mean Absolute Deviation from Mean (MAD Mean)                    0.7324641
13 Mean Absolute Deviation from Median (MAD Median)                0.7324526
14 Median Absolute Deviation from Mean                             0.5886378
15 Median Absolute Deviation from Median                           0.5800523
16 Mean Squared Deviation from Mean                                0.9237851
17 Mean Squared Deviation from Median                              0.9238588
18 Interquartile Difference (Weighted Average at Xnp)              1.1412143
19                      (Weighted Average at X(n+1)p)              1.1479336
20                  (Empirical Distribution Function)              1.1435906
21      (Empirical Distribution Function - Averaging)              1.1435906
22  (Empirical Distribution Function - Interpolation)              1.1377373
23                              (Closest Observation)              1.1435906
24         (True Basic - Statistics Graphics Toolkit)              1.1479336
25                          (MS Excel (old versions))              1.1435906
26 Semi Interquartile Difference (Weighted Average at Xnp)         0.5706071
27                           (Weighted Average at X(n+1)p)         0.5739668
28                       (Empirical Distribution Function)         0.5717953
29           (Empirical Distribution Function - Averaging)         0.5717953
30       (Empirical Distribution Function - Interpolation)         0.5688686
31                                   (Closest Observation)         0.5717953
32              (True Basic - Statistics Graphics Toolkit)         0.5739668
33                               (MS Excel (old versions))         0.5717953
34 Coefficient of Quartile Variation (Weighted Average at Xnp)   -10.6117404
35                               (Weighted Average at X(n+1)p)   -11.5405659
36                           (Empirical Distribution Function)   -11.1615030
37               (Empirical Distribution Function - Averaging)   -11.1615030
38           (Empirical Distribution Function - Interpolation)   -11.3393434
39                                       (Closest Observation)   -11.1615030
40                  (True Basic - Statistics Graphics Toolkit)   -11.5405659
41                                   (MS Excel (old versions))   -11.1615030
42 Number of all Pairs of Observations                         11175.0000000
43 Squared Differences between all Pairs of Observations           1.8599701
44 Mean Absolute Differences between all Pairs of Observations     1.0720356
45 Gini Mean Difference                                            1.0720356
46 Leik Measure of Dispersion                                      0.5104762
47 Index of Diversity                                              0.8668444
48 Index of Qualitative Variation                                  0.9906794
49 Coefficient of Dispersion                                     -10.7276914
50 Observations                                                  150.0000000

To compute the Variability measures, the R code uses several standard and custom-made functions.

66.32 Purpose of Variability in general

Variability measures are mainly used to summarize univariate variables. As such they are used as a descriptive statistic of the underlying probability distribution. They are extensively used in a wide variety of other statistical methods such as Bootstrap Plots, Mean Plots, Hypothesis Testing, and many types of statistical modeling.

From the Explorative Data Analysis point of view, Variability is used as a measure of uncertainty that is associated with a variable or a predictive model. The quality of a prediction model will, generally speaking, be better if the variability of the prediction errors is smaller.

Gini, Corrado. 1912. “Variabilità e Mutabilità.” Studi Economico-Giuridici Della Facoltà Di Giurisprudenza Dell’Università Di Cagliari 3: 3–159.
Leik, Robert K. 1966. “A Measure of Ordinal Consensus.” Pacific Sociological Review 9 (2): 85–90. https://doi.org/10.2307/1388242.
Simpson, Edward H. 1949. “Measurement of Diversity.” Nature 163 (4148): 688. https://doi.org/10.1038/163688a0.
65  Central Tendency
67  Skewness & Kurtosis

© 2026 Patrick Wessa. Provided as-is, without warranty.

Feedback: e-mail | Anonymous contributions: click to copy (Sats) | click to copy (XMR)

Cookie Preferences