⚡0 XP🔥0

Distributions, Outliers and Correlation

Lesson 4 of 5 ⏱ 5 min read ❓ 5-question quiz ▶ Runs Python

Understand the shape of data with histograms and box plots, normal and skewed distributions, detect outliers with the IQR rule, and measure relationships with correlation - without confusing correlation and causation.

The shape of data#

A distribution describes how often each value (or range of values) occurs. Two charts show it best:

  • Histogram - bars showing how many values fall in each range ("bin").
  • Box plot - shows median, quartiles and outliers in one compact picture.
▶ Try it YourselfPython
Ctrl + Enter to run

Common shapes#

Shape Looks like Mean vs median Examples
Normal (bell curve) symmetric hump mean ≈ median heights, exam marks, measurement errors
Right-skewed long tail to the right mean > median salaries, order values, house prices, delivery delays
Left-skewed long tail to the left mean < median age at retirement, easy-exam scores
Uniform flat mean ≈ median dice rolls, random IDs
Bimodal two humps - restaurant orders at lunch and dinner
▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

The normal distribution and the 68-95-99.7 rule#

In a normal distribution:

  • about 68% of values lie within 1 SD of the mean,
  • about 95% within 2 SD,
  • about 99.7% within 3 SD.

So if exam marks have mean 65 and SD 12, about 95% of students score between 41 and 89.

हिंदी में समझें

Distribution = data का "आकार" - कौन-सी values ज़्यादा आती हैं, कौन-सी कम।

  • Normal (घंटी जैसा आकार) - ज़्यादातर values बीच में, दोनों तरफ़ बराबर कम होती जाती हैं। जैसे लंबाई, exam marks।
  • Right-skewed (दाईं ओर लंबी पूँछ) - ज़्यादातर values छोटी, कुछ बहुत बड़ी। जैसे salary, order value। यहाँ mean > median होता है।

Business data ज़्यादातर right-skewed होता है - इसलिए हमेशा histogram देखें और median भी निकालें।

Outliers#

An outlier is a value far from the rest. It can be:

  • a genuine extreme (a bulk corporate order),
  • an error (quantity typed as 5000 instead of 5),
  • a special event (Diwali sale day).

The IQR rule#

IQR = Q3 - Q1
Lower fence = Q1 - 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR
Values outside the fences are potential outliers.
▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

These "outliers" are mostly Technology orders - laptops and phones. They're genuine, not errors, so we keep them, but we analyse them separately (or use medians) so they don't distort averages.

Common Mistake

Never delete outliers automatically. Investigate first: error → fix; genuine → keep (and maybe analyse separately); special event → label it.

Correlation#

Correlation measures how strongly two numeric variables move together, from -1 to +1:

Value Meaning Example
+0.7 to +1 strong positive advertising spend ↑, sales ↑
+0.3 to +0.7 moderate positive study hours ↑, marks ↑
-0.3 to +0.3 weak / none shoe size and salary
-0.7 to -0.3 moderate negative discount ↑, profit ↓
-1 to -0.7 strong negative price ↑, units sold ↓
▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

The correlation is about -0.30 (a moderate negative relationship), and the total by discount level shows the business story clearly: 30% discounts lose money overall.

Correlation is not causation#

हिंदी में समझें

Correlation ≠ Causation - दो चीज़ें साथ-साथ बढ़ें, इसका मतलब यह नहीं कि एक दूसरी का कारण है।

उदाहरण: गर्मियों में आइसक्रीम की बिक्री और डूबने की घटनाएँ - दोनों बढ़ती हैं। आइसक्रीम डूबने का कारण नहीं है; दोनों का असली कारण है गर्म मौसम (तीसरा factor - confounding variable)।

Analyst के रूप में "X की वजह से Y हुआ" कहने से पहले दूसरे कारण भी जाँचें।

Before saying "X causes Y", check for:

  • a third factor (season, region, store size),
  • reverse causation (does Y cause X?),
  • coincidence in small samples.

Proving causation needs controlled experiments (A/B tests) - beyond correlation.

Summary#

  • Histograms and box plots show a distribution's shape; business data is often right-skewed.
  • Normal data follows the 68-95-99.7 rule.
  • Detect outliers with the IQR rule - investigate before removing.
  • Correlation (-1 to +1) measures linear relationships; it does not prove causation.

Quick Quiz

Q1.

In a right-skewed distribution (like order values), usually...

Q2.

With Q1 = 500 and Q3 = 6,500, what is the upper outlier fence (Q3 + 1.5 × IQR)?

Q3.

A correlation of -0.85 between price and units sold means...

Q4.

Ice-cream sales and drowning incidents are positively correlated. What is the best explanation?

Q5.

Which chart best shows the distribution of a single numeric column?