# Quartiles and Box Plots

Just like histograms, box plots (also known as box and whisker plots) are a way to visually represent numeric data. Box plots divide the data into equally sized intervals called quartiles.

## Quartiles

All sets of numeric data can be broken up into quartiles, or four equal sized segments that each contain exactly a quarter (25%) of the data.

The points where the quartiles are split have specific names:

• Q1, the end of the first quartile, is the 25th-percentile. This means that at Q1, there is 25% of the data below that point.
• Q2, the end of the second quartile, is the 50th-percentile (which is also the median). This means that at Q2, exactly half of the data is at or below that point (and exactly half is at or above).
• Q3, the end of the third quartile, is the 75th-percentile. This means that at Q3, there is 75% of the data below that point.

Visually, we can see the data split into the four quartiles by the Q1, Q2 and Q3:

• Calculating Q2: To find Q2, all we have to do is calculate the median of the data
• Calculating Q1 and Q3: To find Q1 and Q3, we can't just take the midpoint of two data points. Instead we use the following formula first to find the true location:
• True Location = (# of data points - 1) X percentile of interest
• After finding the true location, we can use the following formula to calculate Q1 and Q3:
• (Low #) + (High # - Low #) X fraction%
• In the formula above, low # represents the number to the left of the true location and high # represents the number to the right of the true location. Fraction% represents the decimal component of the true location. For example if true location = 2.75, fraction% = 0.75

## Box Plots

Box plots (also known as box and whisker plots) provide a visualization that provide three key benefits compared to other visualization of data:

1. Box plots show the size of the center quartiles and the values of Q1, Q2, and Q3.

2. Box plots show the interquartile range (commonly called the IQR), a measure of the spread of the data. The IQR is the value of Q3 - Q1.

The IQR tells us the range of the middle 50% of the data. In other words, it tells us the width of the “box” on the boxplot.

3. Box plots show outliers in the dataset. Outliers are data points that differ significantly from most of the other points in the dataset. In other words, they “lie outside” most of the data. They are plotted as single dots on a boxplot. You can calculate outliers mathematically using these rules:

• Low Outliers: All values less than Q1 - (1.5 × IQR).
• High Outliers: All values greater than Q3 + (1.5 × IQR).

Outliers can be typos, lies, or real data! Outliers can have a strong effect on certain statistics (like the average) so it’s important that as a data scientist, you recognize outliers and decide if you want to include them in your analysis. Outliers should only be excluded from analysis for a good reason!

Here is an example of a horizontal box plot with each component of the box plot labeled:

# Example Walk-Throughs with Worksheets

### Video 1: Calculating Quartiles and Outliers

Follow along with the workseet to work through the problem:

### Video 2: Reading and Drawing Box Plots

Follow along with the workseet to work through the problem:

# Practice Questions

Q1: How do you find the interquartile range (IQR)?
Q2: Q2 is at what percentile of the data in any data set?
Q3: What is the IQR minus the minimum of the following boxplot? Q4: Which value is larger: the percentage of data between Q1 and Q2 or the percentage of data between Q2 and Q3?
Q5: Outliers are always: