Median and Quartiles
Compute min, Q1, median, Q3 and max with linear interpolation.
Median and quartiles
Put the data in order and read off the value in the middle. That value is the median (Q2 = P50). The first quartile Q1 = P25 marks the bottom 25%, while the third quartile Q3 = P75 marks the top 25%. Take 1..9 as an example and you get Q1 = 3, median = 5, Q3 = 7. Most methods locate a value using the linear position k = (P/100)ยท(n+1), then interpolate between the neighboring points. Tukey (1977) gave us the five-number summary (min, Q1, Q2, Q3, max), which is what a boxplot draws. The reason people reach for it instead of the mean is robustness. The median barely flinches at outliers, so when Bill Gates walks into a bar, the median salary stays put.
Applications
Income distribution is the classic case, since the median lines up with the "typical" person better than a Brazilian mean that the top earners drag upward. You also see it in SRE latency reporting (P50/P95/P99), school grades, biometrics, salary surveys by role, and pretty much any skewed dataset where the mean would lead you astray.
FAQ
Median or mean โ which to use? The mean takes every value into account, which is also why a few extremes can yank it around. The median just sits at the middle of the order. When a distribution is skewed, like income or prices, go with the median.
How is the median computed with an even n? There is no single middle value, so you average the two that share the center. Sort a set of n = 10 and the median is (x5 + x6) / 2.
Why do different software give different quartiles? Because there isn't one agreed definition. Hyndman & Fan (1996) counted at least nine ways to define a quantile, so Excel, R, and NumPy can each hand back a slightly different Q1/Q3 for the same numbers. The gap shrinks toward nothing as n grows.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.