Data Visualization for Education

SDP Institute for Leadership in Analytics February 2014

Jared Knowles
Research Analyst, Wisconsin DPI

The Problem of Data Visualization

  • Data use is increasing rapidly within the education space
  • Policymakers are under increasing pressure to use data to inform decisions, justify funding, and guide practice
  • But, policymakers are often not statisticians, researchers, or quants
  • Data visualization is a way to bridge this gap
  • Proper data visualization will bring the data to the audience in a way they can understand quickly and use to inform decisions

Follow Along

What is dataviz?

Dataviz is...

  • An exploratory tool for understanding datasets
  • A communication tool for framing decisions and depicting problems
  • A way to showcase
  • A better way to present results of analyses

Dataviz is not...

  • Easy
  • A replacement for analysis
  • Infographics
  • Easy!

Data visualization is a tool for communicating a specific feature of a datset in an approachable and efficient manner

If a picture is worth a thousand words, a good data visualization must always be better than a table.

Student Growth

Objectives

  1. Review data visualization principles
  2. Look at applications in education data
  3. Best practices and advice
  4. Review tools to use
  5. Activity!

Example

How can we improve this simple scatterplot?

plot of chunk plot

Principles

  • Elements of a chart
  • Chart Types and Data Types
  • Dimensionality
  • Scale
  • Complexity
  • Technical details
  • Beyond charts

plot of chunk plot1

Chart Elements

There are a few things that all charts need [most of the time!]:

  • Axis labels and a title
    • These make the chart self-explanatory
  • A legend
    • What is the unit in the graphic?
  • A scale
    • How are units mapped to the visual space
  • Annotations
    • Author and data source (depending on distribution)

These add up to provide context and meaning to viewers who have not analyzed the dataset themselves.

Dimensions

  • Charts and data are made up of dimensions (e.g. a bar chart is x and y)
  • Additional dimensions can be represented by additional aesthetics or chart elements (e.g. color, size, shape, etc.)
  • Dimensions can also be shown by multiple plots (e.g. a filmstrip)
  • Smart use of dimensions allows us to increase the information density of our charts

plot of chunk unnamed-chunk-2

How you turn dimensions in the data into visual cues for your audience is everything.

Reviewing Chart Types

Stacked Bar

Box and Whisker

Bullet Chart

Calendar

Lines

Parallel Sets

Tree Map

Word Cloud

Data Types

  • Any given dimension may be measured at different levels of measure [derived by Stanley Smith Stevens in the 1940s and 50s]
    • Nominal: unordered categories of data (e.g. race)
    • Ordinal: ordered categories of data, relative size and degree of difference between categories is unknown (e.g. Likert scales, proficiency levels, etc.)
    • Interval: ordered categories of data, fixed width (e.g. grade level in school, GPA)
    • Continuous (ratio): a measurement scale in a continuous space with a meaningful zero (e.g. scale scores)

Mapping Levels of Measure to Visual Cues

Aesthetics for Mapping

How do we map levels of measurement onto visual features of charts?

Aesthetic Discrete Continuous
Color Disparate colors Sequential or divergent colors
Size Unique size for each value mapping to radius of value
Shape A shape for each value does not make sense

Ordered vs. Unordered

Aesthetic Ordered Unordered
Color Sequential or divergent colors Rainbow
Size Increasing or decreasing radius does not make sense
Shape does not make sense A shape for each value

Some tips

  • Focus on the content and the context
  • Know your audience, understand their limits, then push them!
  • Use best practices, except when they don't help
  • Experiment and iterate!

Charting Categorical Data

plot of chunk unnamed-chunk-3

Charting Ordinal Data

plot of chunk unnamed-chunk-4

Charting Interval/Continuous Data

plot of chunk unnamed-chunk-5

Think like a map. Data density and easy interpretability.

Maps

Complexity

How do we display thousands or hundreds of thousands of observations with varying data types across multiple dimensions?

  1. Summarize the data
    • Display summary statistics visually depicting the central tendency and spread of data
  2. Plot the raw data
    • Annotate wisely to display the main message
  3. Model the data
    • Use a statistical model to summarize features of the data

Let's look at some examples of this.

Summarizing Data

  • The most simple summaries are measures of central tendency, most easily understood
  • It is important to look at the spread of data too though
  • If time is of interest, we are interested in trends
  • If space is of interest, we are interested in maps or spatial distributions
  • Think about context and reference
  • Let's look at an example summarizing student data to schools!

Plotting Means

Here is a simple plot of mean school reading scores:

plot of chunk plotmeans

But, what's wrong with this plot?

Mistakes

  • No sense of scale
  • Means can be skewed
  • Simple means are not meaningful
  • With assessment scores we need to know grade distribution
  • Let's try to improve this

plot of chunk plotmeanssmall

Adding a Dimension

plot of chunk meanplot2

Even More Dimensions

plot of chunk meanplot3

Annotation

We still aren't sure what the mean scale score means. Let's see a couple more additions that can make this useful.

plot of chunk meanplot4

Caterpillar Plots

plot of chunk catplot1

Raw Data

Sometimes, we can get away with showing the raw data, that is, all data points. We may want to do this for a few reasons:

  • the "wow" effect,
  • because it is easier,
  • or because it looks better aesthetically.

How could it be done?

600,000 Observations Too Many

plot of chunk rawdata1

Strategies for Presenting Big Data

  • Without reducing the data points we need to do one or more of three things to be successful
  1. Spread the data out
  2. Bin the data into groups
  3. Annotate and add references

Spreading the Data Out

  1. Repeat the plot for subgroups
    • Allow the viewer to draw comparisons across small plots
  2. Reduce the ink
    • Each point has too much "weight", so make them weigh less
  3. Add Reference Points
    • 600,000 observations in one panel is not meaningful and overwhelms the viewer
  • Edward Tufte and others recommend small multiples, a technique of repeating a plot across groups to compare relationships in multiple dimensions

What About This

plot of chunk rawdata2

Even Smaller Multiples

plot of chunk rawdata3

Binning Data

plot of chunk rawdata4

Modeling the Data

All models are wrong. Some models are useful.

Smoothers

plot of chunk unnamed-chunk-6

Comparing Model Performance

Aiding in Model Choice

Regression Trees

Regression Results

Coefficient Comparisons

Path Diagrams

Illustrating a Model through Simulation

Simulating Outcomes

Combining Features

We can combine these features.

  • Facets with smoother lines for references (small multiples + models)
  • Summary plots with raw data in the background
  • Reference lines and group comparisons

Animation Example

Why does this work?

  • Annotation
  • Labeling
  • Lots of data-ink
  • Reference points galore

Some tips

  • Have a properly chosen format and design
  • Use words, numbers and drawing together
  • Reflect a balance, a proportion, relevant scale
  • Display an accessible complexity of details
  • Have a narrative quality, tell a story
  • Avoid content-free decoration (Tufte's proverbial chartjunk)
  • Draw in a professional manner with an eye on the technical details
  • Provide your audience with the context they need and remember they haven't lived in the data like you!

Themes

They can communicate, confound, brand, and distract

plot of chunk plot2plot of chunk plot2plot of chunk plot2plot of chunk plot2

Technical Details

Graphics Files

Raster

  • Files like jpg , png , gif.
  • Fixed scale, aspect ratio, and size
  • Reasonable file size
  • Viewable in almost any image viewing and editing system, including any modern web browser, PowerPoint, etc.

Vector

  • Files like pdf and svg
  • Infinitely zoomable, adjustable on the fly
  • Larger file size
  • Viewable and usable in fewer systems. SVGs can be used in modern web browsers. PDFs included in other PDF reports.

Technologies

The technology you choose to do visualizations is largely a question of personal productivity, but with some important caveats:

  • In the future, more and more content is going to be delivered in a paperless world, so pick a technology that can leverage web/tablet/phone interfaces
  • Different technologies are useful for different levels of finish and polish; Adobe Illustrator is great for publication quality graphics, R is a great tool for rapidly prototyping different visualizations
  • Chose a technology that best serves your consumer, not you the producer. Charts are a service to the consumer, not to the creator.

Some Technologies

plot of chunk technologies

Programming vs. Illustrating

Keep in mind that depending on the project you may need to programatically make data visualizations, or you may need a highly customized illustrated graphic.

Beyond Graphics

We have a number of other techniques we can use beyond simple charts.

  • Animations
  • Interactive demos
  • Summary tables
  • Videos
  • Web sites
  • Simulations

Group Exercise

Visualize some education data. Imagine we have the following dimensions and want to present more of them on a plot like that on the right. Think about a story you might want to tell and then sketch out your result with your group.

  • Grade
  • Disability Status
  • Type of Disability
  • Language Proficiency
  • School
  • Math Score
  • Reading Curriculum
  • Math Curriculum

plot of chunk studentexample

Example

plot of chunk studentexample2

References

References

Where to Learn Online?

Review of Key Concepts

  • Dimensionality
  • Aesthetics and Mappings
  • Small multiples
  • Spreading the data out
  • Web vs. print
  • Adapt and iterate
  • Modeling the data
  • Themes and style
  • Techniques and software

Contact Information

For Fun

Backmatter

print(sessionInfo(),locale=FALSE)
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] mgcv_1.7-28          nlme_3.1-113         plyr_1.8            
 [4] vcd_1.3-1            hexbin_1.26.3        lattice_0.20-24     
 [7] ggthemes_1.5.1       eeptools_0.3         MASS_7.3-29         
[10] ggplot2_0.9.3.1      knitr_1.5.15         slidifyLibraries_0.1
[13] markdown_0.6.4       whisker_0.3-2        slidify_0.3.3       
[16] devtools_1.4.1      

loaded via a namespace (and not attached):
 [1] abind_1.4-0        arm_1.6-10         car_2.0-19        
 [4] coda_0.16-1        colorspace_1.2-4   data.table_1.8.10 
 [7] dichromat_2.0-0    digest_0.6.4       evaluate_0.5.1    
[10] foreign_0.8-59     formatR_0.10       gtable_0.1.2      
[13] httr_0.2           labeling_0.2       lme4_1.0-6        
[16] maptools_0.8-27    Matrix_1.1-2       memisc_0.96-9     
[19] memoise_0.1        minqa_1.2.3        munsell_0.4.2     
[22] nnet_7.3-7         parallel_3.0.2     proto_0.3-10      
[25] RColorBrewer_1.0-5 Rcpp_0.11.0        RCurl_1.95-4.1    
[28] reshape2_1.2.2     scales_0.2.3       sp_1.0-14         
[31] splines_3.0.2      stringr_0.6.2      tools_3.0.2       
[34] yaml_2.1.10