Chapter 49: R Percentiles

1. What is a Percentile? (Intuitive Explanation First)

A percentile tells you:

“What value is higher than X% of the other values in the data?”

Examples in plain English:

  • The 50th percentile = the median (50% of values are below it, 50% are above)
  • The 25th percentile (Q1) = 25% of values are below it
  • The 75th percentile (Q3) = 75% of values are below it
  • The 90th percentile = only 10% of values are higher than this

Real-life feeling Imagine 100 students take an exam:

  • The 90th percentile mark = 92 → Only 10 students scored 92 or higher → 90 students scored less than 92
  • The 10th percentile mark = 48 → Only 10 students scored 48 or lower

2. How Percentiles Are Calculated (Step by Step)

There are several mathematical methods to calculate percentiles (R uses one of the most common ones by default).

Basic idea (simplified):

  1. Sort the data from smallest to largest
  2. Find the position: position = (percentile / 100) × (n + 1) (n = number of observations)
  3. If position is integer → take that value
  4. If position is not integer → interpolate between two closest values

R’s default method (type = 7) is very close to what Excel, SPSS, and most statistical software use.

3. How R Calculates Percentiles (Hands-on)

The main function is quantile()

R

Interpretation:

  • 0% (minimum) = ₹1,800
  • 25th percentile (Q1) = ₹2,875 → 25% spend less than this
  • 50th percentile = median = ₹3,600
  • 75th percentile (Q3) = ₹4,775 → 75% spend less than this
  • 90th percentile = ₹5,200 → only 10% spend more than this
  • 95th percentile = ₹8,225 → only 5% spend more
  • 100% (maximum) = ₹12,500

4. Very Common Real-Life Uses of Percentiles (Hyderabad Examples)

A – Salary benchmarking

R

→ Naukri.com, Glassdoor, AmbitionBox almost always report 25th, 50th, 75th percentiles — never just the mean.

B – Delivery time (Swiggy/Zomato style)

R

→ Companies advertise “90% orders delivered in 45 minutes” — that’s the 90th percentile.

C – Exam percentile ranks (competitive exams style)

R

5. Important Arguments in R’s quantile()

Argument What it does Default Most common choice
probs Which percentiles (0 to 1) c(0.25, 0.5, 0.75) or seq(0,1,0.05)
na.rm Remove NA before calculation FALSE Always TRUE in real work
names Add names to output (0%, 25%…) TRUE Keep TRUE
type Calculation method (1 to 9) 7 7 (matches Excel & most software)

Always write quantile(x, probs = …, na.rm = TRUE)

6. Quick Cheat-Sheet – When to Use Which Percentile

Percentile Also called What it means Very common use in India
0% Minimum Smallest value Baseline / floor
25% Q1 Bottom 25% are below this Lower quartile
50% Median Half are below, half are above Typical / representative
75% Q3 Top 25% are above this Upper quartile
90% Top 10% are above this “Good” / “high” threshold
95% Top 5% are above this Outlier threshold
99% Top 1% are above this Extreme / elite
100% Maximum Largest value Ceiling

Your Mini Practice Right Now (Copy → Run & Experiment)

R

Now try:

  1. Add five more rides at exactly ₹420 → see how percentiles behave
  2. Make data strongly right-skewed → compare 90th percentile vs mean
  3. Calculate IQR = Q3 – Q1 (interquartile range)

You just saw percentiles in action!

Clearer now?

Next logical questions?

  • Want to learn IQR and outlier detection using percentiles?
  • See boxplot (which shows min, Q1, median, Q3, max)?
  • Compare percentiles across groups (male vs female salary percentiles)?
  • Or jump to variance & standard deviation?

Just tell me — whiteboard is ready! 📊🧮🚀

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *