DEV Community

Cover image for PART 2 - STATISTICS
Sami
Sami

Posted on

PART 2 - STATISTICS

Why Do We Need Descriptive Statistics?

Let’s say we have marks of 10 students:

78, 82, 84, 88, 91, 93, 94, 96, 98, 99

Now think:

  • Are students performing well?
  • Is performance evenly spread?
  • Are there extreme cases?

Just staring at numbers doesn’t help much.

👉 Descriptive statistics exists to summarize data and make it understandable.


Thinking from First Principles: How Is Data Spread?

Instead of complex formulas, let’s ask a simple question:

How can I divide data into meaningful parts?

This brings us to Quantiles.


Quantiles — Dividing Data Logically

A quantile divides data into equal-sized groups.

Think of slicing a cake 🍰 so everyone gets an equal piece.

Types of Quantiles

Name What it does
Quartiles Divide data into 4 equal parts
Quintiles Divide data into 5 equal parts
Deciles Divide data into 10 equal parts
Percentiles Divide data into 100 equal parts

👉 Key idea:

All of these are just different ways of slicing the same data.


Percentiles — The Most Important Quantile

A percentile tells us:

What percentage of values fall below a given value?

Example:

  • 75th percentile → 75% of data lies below this value

Step-by-Step Percentile Example

Data (already sorted):

78, 82, 84, 88, 91, 93, 94, 96, 98, 99

Find the 75th percentile.

Step 1: Find the position

PL = (p / 100) × N

PL = (75 / 100) × 10 = 7.5

This means the value lies between the 7th and 8th observation.

So we interpolate between:

  • 94 and 96

Five Number Summary — One Look Overview

Instead of remembering everything, what if we summarize data using just five numbers?

The Five Numbers:

  1. Minimum
  2. First Quartile (Q1)
  3. Median (Q2)
  4. Third Quartile (Q3)
  5. Maximum

This gives us:

  • Center
  • Spread
  • Range
  • Shape (rough idea)

Interquartile Range (IQR) — Ignoring Extremes

Sometimes extreme values distort reality.

So we focus on the middle 50% of data.

IQR = Q3 − Q1

Used for:

  • Detecting outliers
  • Understanding true variability

Boxplot — Visualizing Distribution

A boxplot visually represents:

  • Minimum
  • Q1
  • Median
  • Q3
  • Maximum

Why boxplots are powerful:

  • Easy to compare datasets
  • Shows skewness
  • Identifies outliers quickly

Scatterplots — Understanding Relationships

So far, we looked at one variable.

Now let’s ask:

How do two variables behave together?

Examples:

  • Experience vs Salary
  • Backlogs vs Package

A scatterplot helps us see:

  • Positive trend
  • Negative trend
  • No pattern

Covariance — Do Variables Move Together?

Covariance answers one question:

When X changes, does Y also change?

Interpretation:

  • Positive covariance → Move in same direction
  • Negative covariance → Move in opposite direction
  • Zero → No linear relationship

⚠️ Problem:

Covariance shows direction, not strength.


Correlation — Strength + Direction

Correlation improves covariance by standardizing values.

Correlation Range:

  • -1 → Perfect negative
  • 0 → No relationship
  • +1 → Perfect positive

This tells us:

  • Direction
  • Strength
  • Comparability

Correlation ≠ Causation (Very Important)

Just because two variables are related doesn’t mean one causes the other.

Example:

  • More firefighters → More damage
  • Real cause → Severity of fire

Always ask:

Is there a hidden variable?


Final Thoughts

Descriptive statistics is not about formulas.

It’s about:

  • Summarizing data
  • Understanding patterns
  • Communicating insights clearly

If you understand why a concept exists, the math becomes easy.


Key Takeaways

  • Quantiles divide data logically
  • Percentiles help comparison
  • Five number summary gives a snapshot
  • Boxplots visualize spread
  • Scatterplots reveal relationships
  • Covariance shows direction
  • Correlation shows strength
  • Correlation never implies causation

If you found this helpful, feel free to share or connect.

Happy learning

Top comments (0)