Compute quartiles (Q1, median, Q3), interquartile range (IQR), detect outliers, and generate an interactive box plot. Ideal for descriptive statistics, data analysis, teaching, and exploratory data visualization. Method: Tukey’s hinges (excluding median for odd n) – consistent with many textbooks and statistical software.
Quartiles divide a ranked dataset into four equal parts. The First Quartile (Q₁) marks the 25th percentile, the Median (Q₂) the 50th percentile, and the Third Quartile (Q₃) the 75th percentile. Together with the minimum and maximum, they form the five-number summary, a robust foundation for describing data distribution, skewness, and spread.
Tukey's method (hinges) – sort data, then:
Median = middle value (average of two middle values if even).
Q₁ = median of the lower half (excluding median if n odd).
Q₃ = median of the upper half (excluding median if n odd).
The Interquartile Range (IQR = Q₃ − Q₁) measures statistical dispersion. Values below Q₁ − 1.5·IQR or above Q₃ + 1.5·IQR are flagged as potential outliers, a standard rule in exploratory data analysis (Tukey, 1977).
We follow a transparent algorithm:
This method (hinges) is widely adopted in introductory statistics (Moore & McCabe) and matches the boxplot.stats default in R. For precise reproducibility, we provide explicit results.
Dataset (monthly spending in USD): 22, 25, 29, 31, 34, 38, 42, 46, 52, 58, 120, 200. After calculating: Q₁ = 30.0, Median = 40.0, Q₃ = 55.0, IQR = 25.0. Upper fence = 55 + 1.5×25 = 92.5 → values 120 and 200 are clear outliers (high spenders). This insight drives targeted retention campaigns and validates segmentation. The box plot reveals right skew and distinguishes typical from exceptional behavior.