Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 2 — Measures of Dispersion

Lesson 14 of 46 in the free Introduction to Data Analytics notes on Siksha Sarovar, written by Rohit Jangra.

Measures of Dispersion

Dispersion (variability/spread) measures how far the data values are scattered from the centre. Two datasets can share an identical mean yet be completely different:

Set A: 48, 49, 50, 51, 52      mean = 50, very tight
Set B:  10, 30, 50, 70, 90     mean = 50, hugely spread

Reporting only the mean would hide the entire difference — which is why every summary must pair a measure of centre with a measure of spread.

1. Range

   Range = Maximum value − Minimum value

   Coefficient of Range = (Max − Min) / (Max + Min)

Simplest measure, but uses only two values and is completely determined by the extremes.

Example. Marks 45, 52, 68, 74, 81 → Range = 81 − 45 = 36

2. Quartile Deviation (Semi-Interquartile Range)

   Q1 = lower quartile (25th percentile)
   Q3 = upper quartile (75th percentile)

   IQR = Q3 − Q1
   Quartile Deviation (QD) = (Q3 − Q1) / 2
   Coefficient of QD = (Q3 − Q1) / (Q3 + Q1)

The IQR covers the middle 50% of the data and completely ignores extreme values — making it the natural companion to the median, and the basis of the box plot and outlier fences.

3. Mean Deviation (Average Deviation)

                Σ|x − x̄|
   MD (mean) = ──────────
                   n

                  Σ|x − Median|
   MD (median) = ───────────────      (this version is the minimum possible MD)
                        n

Worked example. Data: 2, 4, 6, 8, 10 → x̄ = 6

|2-6| + |4-6| + |6-6| + |8-6| + |10-6| = 4 + 2 + 0 + 2 + 4 = 12
MD = 12 / 5 = 2.4

4. Variance and Standard Deviation

The most important measures in all of statistics.

POPULATION                              SAMPLE

        Σ(x − μ)²                              Σ(x − x̄)²
  σ² = ───────────                       s² = ───────────
            N                                     n − 1

  σ = √σ²                                 s = √s²

  Divisor n−1 (Bessel's correction) makes the sample variance an
  UNBIASED estimator of the population variance.

Shortcut / computational formula:

        Σx²      ( Σx )²
  σ² = ─────  −  ───────
         N          N

Worked example. Data: 2, 4, 6, 8, 10 (treat as population)

xx − μ(x − μ)²
2−416
4−24
600
824
10416
Σx = 30Σ = 0Σ = 40
μ  = 30 / 5 = 6
σ² = 40 / 5 = 8
σ  = √8 = 2.828

As a SAMPLE instead:
s² = 40 / (5 − 1) = 10
s  = √10 = 3.162

Verify with the shortcut formula:

Σx² = 4 + 16 + 36 + 64 + 100 = 220
σ² = 220/5 − (30/5)² = 44 − 36 = 8  ✓

Properties of standard deviation:

  1. σ ≥ 0 always; σ = 0 only when every value is identical
  2. Same unit as the original data (variance is in squared units — its main drawback)
  3. Adding a constant to every value leaves σ unchanged
  4. Multiplying every value by a constant c multiplies σ by |c|
  5. It is the measure minimised by the mean, and it underpins the normal distribution, z-scores, correlation and regression

5. Coefficient of Variation (CV)

        σ
  CV = ─── × 100 %
        x̄

CV is unit-free, so it is the correct tool for comparing variability between datasets with different units or very different means.

Worked example. Which is more consistent?

MeanSDCV
Batsman A50 runs10 runs(10/50)×100 = 20%
Batsman B30 runs9 runs(9/30)×100 = 30%

Batsman B has the smaller standard deviation but the larger CV — relative to his own average he is less consistent. Lower CV = more consistent/stable.

The Empirical Rule (68–95–99.7)

For an approximately normal distribution:

This is exactly why |z| > 3 is the standard outlier threshold — such values occur in under 0.3% of normal data.

Skewness and Kurtosis — Shape Measures

MeasureWhat it describesInterpretation
SkewnessAsymmetry of the distribution0 = symmetric; > 0 = right/positive tail; < 0 = left/negative tail
Kurtosis"Tailedness" / peakedness3 (excess 0) = normal (mesokurtic); > 3 = heavy tails (leptokurtic); < 3 = light tails (platykurtic)
Karl Pearson's coefficient of skewness:

        Mean − Mode              3(Mean − Median)
  Sk = ─────────────    or  Sk = ─────────────────
             σ                           σ

Full Python Walkthrough

import pandas as pd
import numpy as np

data = pd.Series([2, 4, 6, 8, 10])

print("Range:            ", data.max() - data.min())          # 8
print("Variance (sample):", data.var())                       # 10.0   (ddof=1 default)
print("Variance (pop):   ", data.var(ddof=0))                 # 8.0
print("Std dev (sample): ", round(data.std(), 3))             # 3.162
print("Std dev (pop):    ", round(data.std(ddof=0), 3))       # 2.828

Q1, Q3 = data.quantile(0.25), data.quantile(0.75)
print("Q1:", Q1, "Q3:", Q3, "IQR:", Q3 - Q1)                  # Q1: 4.0 Q3: 8.0 IQR: 4.0
print("Quartile Deviation:", (Q3 - Q1) / 2)                   # 2.0

print("Mean Absolute Deviation:", (data - data.mean()).abs().mean())   # 2.4
print("CV:", round(data.std() / data.mean() * 100, 2), "%")   # 52.7 %
print("Skewness:", round(data.skew(), 3))                     # 0.0 (perfectly symmetric)
print("Kurtosis (excess):", round(data.kurtosis(), 3))        # -1.2
# Same mean, very different spread — the whole point of dispersion
A = pd.Series([48, 49, 50, 51, 52])
B = pd.Series([10, 30, 50, 70, 90])

summary = pd.DataFrame({
    "Set A": [A.mean(), A.std(), A.max() - A.min(), A.std() / A.mean() * 100],
    "Set B": [B.mean(), B.std(), B.max() - B.min(), B.std() / B.mean() * 100],
}, index=["Mean", "Std Dev", "Range", "CV %"]).round(2)
print(summary)
#          Set A  Set B
# Mean     50.00  50.00     <- identical
# Std Dev   1.58  31.62     <- 20x difference
# Range     4.00  80.00
# CV %      3.16  63.25
# describe() gives centre + spread + quartiles in one call
df = pd.DataFrame({"marks": [45, 52, 68, 74, 81, 68, 90, 33]})
print(df.describe().round(2))
#         marks
# count    8.00
# mean    63.88
# std     18.83
# min     33.00
# 25%     50.25
# 50%     68.00
# 75%     75.75
# max     90.00

Absolute vs Relative Dispersion

BasisAbsolute measureRelative measure
UnitSame as the dataUnit-free (ratio or %)
Comparison across datasetsOnly if units and scale matchAlways valid
ExamplesRange, QD, MD, SD, varianceCoefficient of range, coefficient of QD, CV

Centre plus spread describes one variable. The next lesson moves to two variables at once — correlation.