Data Analyst Program

Statistics · Week 4 of 4 · 6 hours

Outlier Detection and Exploratory Analysis

Find unusual values and follow a repeatable process to explore any new dataset.

Learning objectives

By the end of this week you will be able to:

  • Calculate quartiles and the interquartile range (IQR).
  • Flag outliers with the 1.5 × IQR rule and read a box plot.
  • Decide what to do with an outlier.
  • Carry out an exploratory data analysis (EDA) from first look to findings.

Lessons

Outlier Detection

An outlier is a value far away from the rest. Outliers can be errors (a price typed as 1000 instead of 10.00) or real and important (one customer who placed a huge order). Either way, you need to find them.

The IQR method, step by step:

  1. Sort the data and find the quartiles. Q1 is the 25th percentile and Q3 the 75th. Excel: =QUARTILE.INC(range,1) and =QUARTILE.INC(range,3).
  2. Interquartile range: IQR = Q3 − Q1. It covers the middle 50% of the data.
  3. Lower fence = Q1 − 1.5 × IQR. Upper fence = Q3 + 1.5 × IQR.
  4. Any value outside the fences is a potential outlier.

Example: Q1 = 30, Q3 = 45, so IQR = 15. Fences: 30 − 22.5 = 7.5 and 45 + 22.5 = 67.5. An order of 250 is an outlier.

Box plots show this visually: the box runs from Q1 to Q3 with a line at the median, the whiskers reach to the furthest non-outlier values, and outliers appear as dots. Excel: Insert > Charts > Box and Whisker.

The z-score method is an alternative for roughly normal data: z = (value − mean) / standard deviation, and |z| > 3 is often treated as an outlier.

What to do with an outlier: investigate before deleting. Fix it if it is an error, keep it if it is real (and maybe report it separately), and always write down what you decided and why.

Exploratory Analysis (EDA)

Exploratory data analysis is the first deep look at a new dataset, done before you build any report. Its goal is to understand the data, check its quality and find questions worth answering. A simple checklist:

  1. Understand the structure: how many rows and columns? What does one row represent? What type is each column?
  2. Check quality: missing values, duplicates, impossible values (negative ages, future dates).
  3. Univariate analysis (one variable at a time): mean, median, standard deviation, min and max for numbers; histograms and box plots; value counts for categories.
  4. Bivariate analysis (two variables): scatter plots and correlation for two numbers; grouped averages and bar charts for a category against a number.
  5. Look at time: if there is a date, plot the main measure over time. Look for trends and seasonal patterns.
  6. Write down findings and questions as you go: "Sales dip every February," "West has the highest average order but the fewest orders."

EDA ties together everything in this course. It is also the heart of the Project course later in the program.

Watch

Practice

Pick a dataset with at least 200 rows. Follow the six-step EDA checklist. Use the IQR method to flag outliers in one numeric column and make a box plot. Record each step in a table: what you checked, what you found, and what you will do about it.

Check your understanding

Try each question first, then open it to see the answer.

Q1 = 20 and Q3 = 40. What is the upper fence?

IQR = 20, so 40 + 1.5 × 20 = 70.

Should you always delete outliers?

No. Investigate first: fix errors, keep real values, and document the decision.

What is the difference between univariate and bivariate analysis?

Univariate looks at one variable at a time; bivariate looks at the relationship between two.

Assignment

Course project: submit a two-page EDA report (spreadsheet or notebook plus summary) covering structure, quality, descriptive statistics, at least three charts, outliers and five findings.