FAQ: Statistical Thinking - Outliers and Robust Measures

This community-built FAQ covers the “Outliers and Robust Measures” exercise from the lesson “Statistical Thinking”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Data Scientist: Analytics Specialist
Data Scientist: Natural Language Processing Specialist
Data Science Foundations
Data Scientist: Inference Specialist
Data Scientist: Machine Learning Specialist

Principles of Data Literacy

FAQs on the exercise Outliers and Robust Measures

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in Language Help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hey there!

I am a little confused about the movement of the median in the “McCartney, BTS, and Beyonce move to the city” example. How does this example produce the calculation that median income moves from $32,978 to $33,011, which is a $33. I am trying to reconcile that with the addition of 3 individual data points.

Thanks!

Suppose we have five data points

2, 3, 6, 7, 8 

For the mean, we just add up all the values and then divide by the number of data points,

Mean = (26 / 5) = 5.2

For the median, we arrange the values in ascending order. If there are an odd number of data points, then we just pick the middle value. If there are an even number of data points, then there is no single data point right in the middle. So we usually take the average of the middle two values.

# (Five data points in total, so middle value is third data point)
Median = 6 

Suppose, we add four more data points as outliers, so that our data is now:

2, 3, 6, 7, 8, 15, 32, 87, 90 

Mean = (250 / 9) = 27.8

# (Nine data points in total, so middle value is fifth data point)
Median = 8 

The outliers changed the mean significantly from 5.2 to 27.8, but the median didn’t change as noticeably from 6 to 8.

In the example mentioned by you, we haven’t been explicitly given all the data points. So, let’s just pretend that there are 1001 data points,

# Pretend data
..., $32900, $32978, $33000, $33022, ... , $81516

# Mean = ( (sum of all 1001 incomes) / 1001 ) 
Mean = $34795

# Suppose $32978 is the 501st data point 
# (500 data points --- middle data point --- 500 more data points),
Median = $32978

Now, let’s add three outliers so that our data has 1004 data points:

# Pretend data
..., $32900, $32978, $33000, $33022, ... , $81516, $48000000, $57000000, $81000000

# Mean = ( (sum of all 1004 incomes) / 1004 ) 
Mean = $228235

# Median
# (501 data points --- 502nd data point, 503rd data point --- 501 more data points)
# Since there are an even number of observations (1004), so the median will
# be the average of the 502nd and 503rd data point,
Median = ($33000 + $33022) / 2
Median = $33011

Since the lesson hasn’t given us the data points, so the above is just a pretend example.

1 Like