Data Visualization - Transcript
♪ (upbeat music) ♪
In the 1850s in London, there was an outbreak of Cholera in the neighborhood of
Soho.
Cholera is a nasty bug that can cause some real problems, including stomach pain
and some ugly related side effects.
It also can become life-threatening quickly if not treated.
At the time of the outbreak, it was believed that Cholera, like many other
diseases, we're familiar with, was caused by germs in the air.
However, one Doctor -- John Snow, was unsure of what to make of a cluster of
cases near him.
And to limit the spread he decided to embark on data analysis.
He mapped the cases as seen here, with bars representing the number of cases.
As you can see, there is a water pump -- the infamous Broad Street pump at the
center of the cases.
Doctor Snow advocated that the handle of the pump be removed, so no one
could access its water anymore.
While the board of guardians who served to manage the city area were not
convinced this was the cause of the outbreak they removed the handle as a
precautionary measure.
As a result, the number of cases dropped from 142 to 14 in seven days.
In subsequent investigations, it seems that the pump water had become infected
by sewage which was dumped in a nearby pit.
This was their version of sewer systems.
It appears that his conclusion -- which was supported and discovered through
data visualization stopped the disease spread and saved lives.
Now imagine what we can do with all of the modern software and data analysis
skills that we have developed over the past centuries.
We are going to learn how to make several types of charts during this course.
Charts are useful because they allow us to make a statement about trends we see
in our data.
When we have hundreds or even thousands of rows of data it can be impossible
to make any sense out of it, but by creating tables and charts to look at our data
in an aggregated way we can start to make sense out of it.
In order to make a chart, you must first decide what type of data you have.
When we have categorical data we can make two main types of charts: a bar
chart, and a pie chart.
To begin making charts we must first do some counting in our data.
In this table, you can see we are displaying the frequency of different types of
mascots found in NCAA schools.
Frequency just refers to a count.
Essentially here we just had technology go through the data set and count the
number of times there was a school that had an Aggie or a Longhorn as the
mascot.
You can see I'm also displaying relative frequency as well.
These are the percentages of the total number of schools included that represent
each type of mascot.
The frequency counts will add up to the total number of schools in the data set
while the relative frequencies will add up to 100%.
Bar charts are the preferred type of charts for most statisticians.
This is a classic example of a bar chart.
Here you can see I have displayed the frequencies for each group.
You can also use a bar chart to display relative frequencies.
Now here's a classic pie chart.
Pie charts only display relative frequencies, and pie charts are not generally very
useful when we're comparing more than two groups, as they can be hard to
make generalizations from due to the ambiguity of the slices.
While in our bar chart the Bears and Bulldogs looked to have quite different
counts.
Visually here, it's hard to see that the groups are different.
When we have numeric data -- we have to change our method for creating
charts.
As you can see here when we have numeric data we have much more variation
between responses.
Therefore, we can't just make a bar chart for each age, or we would have dozens
of bars in our chart and they wouldn't even fit on a single page.
Instead, we create bins for our data.
This means we will look at a group of numbers together and count how many
rows of data match that range of numbers.
For this data, since it ranges from 18 to 95 I decided to use a bin size of ten.
This means we will look at ten whole numbers at a time.
My first bin looks at how many people in the data set said they were between 11
and 20.
We can see there were two people in this range.
For the next bin, we have the people aged 21 to 30 with 104 people in that bin.
You can see I also have displayed some notation, which can base the range of the
data.
In this notation a parenthesis indicates that a number is not included in a bin and
a bracket indicates that it is.
So for the bin that contains ages 21-30, the notation of parenthesis 20 comma 30
bracket means that if someone was 20 -- they were included in the prior bin, but
if someone was 30 -- they were included in this bin.
Now let's see how this looks visually.
This is a histogram.
Histograms are similar to bar charts in structure, except that you can see the bars
are touching.
The reason for this is that it visually cues a reader that they are looking at a
distribution of a numeric variable.
Which we have added artificial divides to, rather than looking at distinct
categories.
Histograms are useful because they can help us see a trend in our data.
Comparing different groups we can see various trends for each different
histogram.
The limitation of a histogram though, is that they are best when we are only
looking at one group at a time.
If we wanted to compare multiple groups, we will instead look at box plot.
In a box plot, we can compare multiple groups at once.
The top of the line or the top point is our maximum value for the group.
The center box is our central range of data, and the thick line at the center is the
center of our data or our median.
The bottom line then is our minimum value.
You can also see that this box plot has identified some points as dots.
This means these points are considered outliers.
Outliers are points that don't fit with the rest of the data -- they stick out from
their group as not similar to the rest.
As you can see, we can use many types of charts to display our data.
Each chart will help you to tell a story and describe your data.
Making charts is the first step we will take when we begin to analyze our data.