1 of 126

Week 4: Exploratory Data Analysis

Introduction to Data Visualization

W4995.003 Spring 2025

2 of 126

00 Quiz

01 Sparks Presentation

02 Revisit: C ⊂ O ⊂ Q

03 Monthly Budget Redesigns

04 What is EDA?

05 EDA Examples: Air Pollution, Stop & Frisk

06 EDA Assignment: Group critique

3 of 126

Quiz

5 min

Closed book

Slide via Jeff Heer

4 of 126

01

Sparks Presentation

Catalogtree

5 of 126

02

Review: Categorical, Ordinal, & Quantitative

6 of 126

Data Types: C ⊂ O ⊂ Q

C: Categorical

Operations: =,

Categories are of equal importance, or “equidistant”

O: Ordered

Operations: =, ≠, <, >

Items of equal importance, or “equidistant”

Q-Interval (location of zero arbitrary)

Operations: =, ≠, <, >, -

Can measure distances or spans, only delta (i.e. intervals) may be compared

Q-Ratio (zero fixed)

Operations: =, ≠, <, >, -, %

Can measure ratios or proportions e.g. Length, Mass, Temp, counts and amounts

Slide via Jeff Heer

7 of 126

William Playfair (1786)

Image via Wikipedia

Inventor of line charts, bar charts, and pie charts.

British pounds

8 of 126

X-axis: year (Q)

Y-axis: currency (Q)

Color: imports/exports (C)

9 of 126

From the Pudding

10 of 126

Rectangle Area: laugh share (Q)

Rectangle Position: category (C)

Color Hue: category (double-encoded) (C)

11 of 126

Map of the Market (Wattenberg 2000)

12 of 126

Rectangle Area: market cap (Q)

Rectangle Position: market sector (C)

Color Hue: loss vs. gain (C)

Color Value: magnitude of loss or gain (Q)

13 of 126

Exercise: data type of zip code?

14 of 126

Ben Fry, Zipdecode (1999)

15 of 126

Zip code trivia (and why it is categorical)

  • Zip codes that begin with '0': most of New England + New Jersey, Puerto Rico, the U.S. Virgin Islands and APO/FPO military addresses
    • 095* for mail to the Navy
  • 00501, a ZIP Code exclusively for the U.S. Internal Revenue Service

Via wikipedia

16 of 126

Note: it’s difficult for a single O/Q value to span 2D

Via wikipedia

One option:

The Hilbert Curve

17 of 126

Compare & Contrast

Left: John Hopkins dashboard, right: Bloomberg

18 of 126

Compare & Contrast

NYTimes

19 of 126

Compare & Contrast

NYTimes

20 of 126

XKCD/NYTimes

21 of 126

03

Monthly Budgets

22 of 126

23 of 126

24 of 126

25 of 126

Stream graphs

A variation on the stacked area chart

26 of 126

27 of 126

03

What is Exploratory Data Analysis?

28 of 126

Design

Computer Graphics

HCI

Psychology

Statistics

Cartography

dataviz

29 of 126

EDA is...

A style of data analysis that employs graphical & statistical techniques to:

  • uncover underlying structure
  • detect outliers and anomalies
  • test assumptions

EDA always precedes formal (confirmatory) data analysis.

30 of 126

“The greatest value of a picture is when it forces us to notice what we never expected to see.”

— John Tukey

31 of 126

Anscombe’s Quartet

Anscombe’s Quartet (1973)

Mean & Variance

uX = 9.0, σX = 11

uY = 7.5, σY = 4.125

Linear Regression

Y = 3 + 0.5X

R^2 = 0.67

32 of 126

Tukey 1977

Based on insights developed at Bell Labs in ’60s

Introduced new techniques for visualizing and summarizing data:

  • 5-number summary
  • Box plots (visual 5-number)
  • Stem and leaf diagrams

33 of 126

Boxplot 5-Number Summary

34 of 126

Boxplot 5-Number Summary

35 of 126

Note: Max/Min in Boxplots

https://www.leansigmacorporation.com/box-plot-with-minitab/

36 of 126

Counterintuitive: less space means more density

https://www.leansigmacorporation.com/box-plot-with-minitab/

37 of 126

EDA differs from classical analysis

Exploratory data analysis is sometimes compared

to detective work: it is the process of gathering evidence.

Confirmatory data analysis is comparable to a

court trial: it is the process of evaluating evidence.

38 of 126

We use graphics in data analysis to...

  • understand data properties (1D)
  • find patterns in the data (2D+)
  • suggest modeling strategies
  • "debug" analyses
  • communicate results

Use visual pattern detection to guide analysis

39 of 126

Identifying trends

Constant

Periodic

Linear

Exponential

40 of 126

Identifying trends

41 of 126

Identifying trends

42 of 126

Simple distributions

Uniform

Normal

Exponential

Graphics via Petra Isenberg

43 of 126

Simple distributions

Log-Normal

Skewed right (tail on right)

Skewed left

Graphics via Petra Isenberg

44 of 126

Use EDA to help you guess appropriate models

https://blog.cloudera.com/blog/2015/12/common-probability-distributions-the-data-scientists-crib-sheet/

45 of 126

What we do when we do EDA...

  • First step: formulate hypotheses

Next steps, iterative:

    • Test hypotheses to later confirm them
    • Refute them (or just discard them)
    • Generate new hypotheses from results

46 of 126

“The goal of data exploration is to generate many promising leads that you can later explore in more depth.”

R for Data Science, Wickham

47 of 126

Characteristics of exploratory graphs

  • make quickly
  • large number are made (keep saving copies)
  • goal is for personal understanding
  • axes/legends are generally cleaned up later
  • color/size are primarily used for information
    • (cf. in presentation you might think more carefully about your encodings)

48 of 126

04

EDA Example: EPA Air Pollution

Via Roger Peng, John Hopkins Biostatistics

49 of 126

Dataset: Air Pollution in the US

  • EPA says: fine particle pollution (PM2.5), the “annual mean, averaged over 3 years” cannot exceed 12 μg/m3

  • Question: Are there any counties in the U.S. that exceed that national standard for fine particle pollution?

50 of 126

Overview of Process

  • import/clean
  • single variable exploration (1D)
  • pairwise exploration (2D)
  • multivariate analysis (3+)

51 of 126

Dataset: Air Pollution in the US

pm25 fips region long lat

9.771 01003 east -87.75 30.59

9.994 01027 east -85.84 33.27

10.689 01033 east -87.73 34.73

11.337 01049 east -85.80 34.46

12.120 01055 east -86.03 34.02

10.828 01069 east -85.35 31.19

Via Roger Peng, EPA 2008-2010 https://aqs.epa.gov/aqsweb/documents/data_mart_welcome.html

52 of 126

Boxplot: PM2.5

53 of 126

Boxplot with overlaid feature

54 of 126

Histogram: PM2.5

55 of 126

Histogram with different bin size

56 of 126

Second variable: Categorical

57 of 126

Small multiples: PM2.5 x Region

58 of 126

Small multiples: PM2.5 x Region

the levels in eastern counties are on average higher than the levels in western counties.

59 of 126

Multiple histograms: PM2.5 x Region

60 of 126

Scatterplot: PM2.5 x Latitude

South

North

61 of 126

Scatterplot: PM2.5 x Latitude

highest levels of PM2.5 tend to be in the middle region of the country.

~South

~North

62 of 126

Scatterplot: PM2.5 x Latitude x Region

East: black

West: red

63 of 126

Easier if separate: PM2.5 x Latitude x Region

64 of 126

04

EDA Example: NYPD Stop & Frisk

65 of 126

“Stop, Question, and Frisk” by Bloomberg’s NYPD

  • 2003–2013: over 100,000 stops were made per year
    • 2002: 97,296 people stopped
    • 2011: 685,724

  • In 2010: 85% of people stopped by the police were Black or Latino, although those groups make up only slightly more than half of the city’s population.

66 of 126

“Stop, Question, and Frisk” by Bloomberg’s NYPD

  • Opponents of the program have criticized that it is racist and failed to reduce robbery, burglary, or other crime.

  • Proponents argue “stops save lives in communities disproportionately affected by crime”
    • citing: young men of color represented 90% of murder victims and 96% of shooting victims in NYC, 2010

67 of 126

“Stop, Question, and Frisk” by Bloomberg’s NYPD

  • In Floyd v. City of New York, Aug. 12, 2013: US District Court Judge Shira Scheindlin ruled the practice unconstitutional and ordered NYPD to adopt a written policy to specify where such stops are authorized. (“probable cause”)

  • Oct. 31, 2013: Court of Appeals ruled against appeal and allowed city to proceed with overhaul.

68 of 126

Hypotheses & questions

  1. The number of people stopped, questioned, and frisked in New York City declined after Floyd v. City of New York on Oct. 31, 2013.

  • After adopting the “probable cause” standard, are police making fewer and/or more effective stops?

  • Is the racial disparity narrowing?

69 of 126

70 of 126

71 of 126

72 of 126

73 of 126

Data Source

  • NYPD (via NYC Open Data)
  • 2013–2015
    • data format is uniform so using this as preliminary exploration
  • Fields
    • Date
    • Frisked?
    • Arrested?
    • Race

74 of 126

75 of 126

Hypothesis 1

The number of people stopped, questioned, and frisked in New York City declined after Floyd v. City of New York on Oct. 31, 2013.

76 of 126

Overall, looks like significant decline in number of stops

77 of 126

Plotting by day, we see there might be misformatted or missing data.

Missing data?

78 of 126

Zooming in we see:

Number of stops seems to fluctuate significantly but regularly.

This could be due to weekend/week-

day or reporting patterns.

79 of 126

Overall, stop and frisks declined after the Floyd decision.

However, there was already a downward trend from early 2012 in the number of stops.

Further research is needed to understand how the court orders were implemented.

Lawsuit

Decision

80 of 126

Hypothesis 2

After adopting the stricter “probable cause” standard, are police making a) fewer and b) more effective stops?

81 of 126

Most stops don’t result in an arrest.

In fact only about 1 out of 10 results in an arrest.

82 of 126

Over 2013-2015, with decline in number of stops, number of arrests have also declined.

83 of 126

By 2015, percentage of stops that resulted in arrests were more than double that of 2013.

84 of 126

Hypothesis 3

With the change in procedure, is racial disparity also narrowing?

85 of 126

There’s a lot of messy data in the field.

86 of 126

Using valid values from data spec sheet, we can filter out invalid values.

87 of 126

Already we see disproportionate representation.

88 of 126

When splitting into into small multiples by year, overall decrease in number of stops masks any changes we can see. What we’re interested in comparing is part-of-whole.

89 of 126

Abela, Advanced Presentations by Design, 2013 redrawn by Berinato in Good Charts

90 of 126

There may be a very slight trend towards less racial disparity.

91 of 126

A slightly clearer view of the same, since very slight differences in slope are hard to perceive.

92 of 126

Summary: Exploratory Data Analysis

  • Exploratory plots are "quick and dirty"
  • Let you summarize the data (usually graphically) and highlight any broad features
  • Explore basic questions and hypotheses (and perhaps rule them out)
  • Suggest modeling strategies for the "next step"

93 of 126

Summary: Exploratory Data Analysis

  • Use histograms to look at distributions + basic statistics
  • Use scatterplots and aligned bar charts to see potential correlations between pairs of variables
  • Use line charts to find patterns in time series

94 of 126

Additional EDA Resources

  • Handbook of Statistical Methods (good summary)

https://itl.nist.gov/div898/handbook/eda/eda.htm

  • Allen Downey Think Stats (examples in python)

http://greenteapress.com/thinkstats2/html/thinkstats2002.html

  • Spotify Team @ Tableau Conference (real-world)

https://www.youtube.com/watch?v=pgSLSYLNEq0

95 of 126

06

EDA: Brainstorming session

96 of 126

Form pairs with someone not in your group

3 min each

Describe the topics you’re examining and the data set you’ve found, then share your initial charts

5 min

Work independently to come up with 3 hypotheses for the other group’s topic. Suggest at least one additional variable that could be interesting.

97 of 126

Form pairs with someone not in your group

5 min

Compare your hypotheses with your partner’s and choose which seem most interesting/fruitful for further investigation

98 of 126

06

Tableau Concepts

99 of 126

Tableau/Polaris Contribution

  • One declarative language (“formalism”) can simultaneously specify both database queries and visualization
  • Choose data, then visualization, not vice versa
  • Use smart defaults for visual encodings

100 of 126

Taxonomy of vis types

Stolte, et. al. Polaris, ACM 2008.

101 of 126

Tableau UI chart types

Valid chart types for the selected dimensions & measures

102 of 126

103 of 126

Tableau Fields: “Scale” of Fields

Nominal

Ordinal

Q-Ratio

Q-Interval

Discrete

Continuous

104 of 126

Continuous

Discrete

105 of 126

Table Algebra to specify configurations

Operands are the database fields

Each operand interpreted as a set {...}

Continuous and Discrete fields treated differently

Three operators

concatenation (+)

cross product (x)

nest (/)

Via Jeff Heer.

106 of 126

107 of 126

x

108 of 126

109 of 126

110 of 126

111 of 126

112 of 126

/

113 of 126

114 of 126

+

115 of 126

/

+

x

Via Jeff Heer.

116 of 126

/

+

x

Via Jeff Heer.

GROUP BY category, region, segment

117 of 126

Relational Data Model

  • Represent data as a table (or relation)
  • Each row (or tuple) represents a record
  • Each record is a fixed-length tuple
  • Each column (or field) represents a variable
  • Each field has a name and a data type
  • A table’s schema is the set of names and types A database is a collection of tables (relations)

118 of 126

Example: U.S. Census Data

People Count: # of people in group

Year: 1850–2000 (every decade)

Age: 0–90+

Sex: Male, Female

Martial Status: married,

never married,

widowed,

divorced

Example via Jeffrey Heer.

119 of 126

“Roll-Up” and “Drill-Down”

Examine population by year and age?

Roll-up the data along the desired dimensions

SELECT year, age, SUM(people)

FROM census

GROUP BY year, age

Via Jeff Heer.

Dimensions

Measure

120 of 126

Drill-Down

see the breakdown by marital status?

Drill-down into additional dimensions

SELECT year, age, marst, SUM(people) FROM census

GROUP BY year, age, marst

Via Jeff Heer.

121 of 126

Data Cube Concept

Via Jeff Heer.

122 of 126

Via Jeff Heer.

123 of 126

Via Jeff Heer.

124 of 126

Questions?

Next Week…

125 of 126

Topics Next Week

  • Marks & Channels

  • Expressiveness & Effectiveness

  • Grammar of Graphics

  • (A2 feedback next week)

126 of 126

Checklist For Next Week

  • Assignment 3
    • Submit PDF or slides, video or link to your Tableau Dashboard
    • Follow template structure
    • Yes it is EDA, but remember to label everything for graders

  • Readings
    • Norman Power of Representation
    • Tufte Visual Display of Quantitative Information
    • McCloud Understanding Comics: Lines, Six Steps, Color
    • Optional: Choropleth maps (read this if you want to make a map)
    • Optional: Original D3 paper