1. Home
  2. Explore
  3. Statistics
  4. Biostatistics and Data Science

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Biostatistics and Data Science

Speaker 1Speaker 2

Biostatistics and Data Science

15:34
0:00-15:34
  1. Maria

    Welcome to today's episode on exploratory data analysis, or EDA. Our guide is Brian Caffo, a biostatistics professor at Johns Hopkins who works in statistical computing, generalized linear mixed models, neuroimaging, fMRI, image processing, and big-data prediction. He also co-created the Coursera Data Science Specialization and the SMART Group, which focuses on statistical methods for biological signals.

  2. Simon

    Before we get into the main topic, there's a great visualization example connected to his research. A former PhD student, Bruce Swihart, wrote about using heat maps for longitudinal data and gave the paper the memorable title, “Lasagna Plots, a Saucy Alternative to Spaghetti Plots.”

  3. Maria

    The idea is that spaghetti plots can become a tangled black mass when many subjects or measurements are drawn on top of one another. A heat map, or lasagna plot, can make patterns easier to see, including missing-data patterns and differences between groups. In one example involving sleep-disordered breathing and EEG signals, subjects with the disorder showed more red than subjects without it.

  4. Simon

    And the practical resources differ depending on what you need. Roger Peng's book and Coursera course are useful for learning how to perform EDA in R. John Tukey's book is considered a foundational resource—the “Bible” of exploratory data analysis. The lecture we're discussing is less about software syntax and more about the principles that apply whether you're using R, Python, SAS, or another tool.

  5. Maria

    So what exactly is exploratory data analysis? The traditional comparison is between exploratory data analysis, which focuses on discovery and hypothesis generation, and confirmatory data analysis, which focuses on confirming hypotheses.

  6. Simon

    That does not mean EDA ignores uncertainty. Exploratory analysis can still control error rates and quantify uncertainty, but usually in a looser and less structured way. Confirmatory analysis is more likely to use formal inference and prediction techniques according to a planned protocol.

  7. Maria

    A useful analogy is improvisational jazz for EDA and a symphony for confirmatory analysis. EDA is more free-form and flexible, while confirmatory data analysis is more prescriptive, planned, and protocolized.

  8. Simon

    In practice, most analyses fall somewhere between those extremes. Highly regulated clinical trials tend to be closer to the confirmatory end, while areas involving high-throughput measurements, such as genomics, are often more exploratory. That's why the EDA-versus-CDA division is especially useful conceptually, even if it is not always a clean practical division.

  9. Maria

    An alternative distinction is whether a study is driven by strongly phrased scientific hypotheses or is primarily empirical. That may be more useful in some settings than forcing every project into an exploratory or confirmatory category.

  10. Simon

    But there is an important warning. If you explore a dataset extensively, discover an interesting pattern, and then present only the final analysis as though it had been planned from the start, you risk p-hacking or a phishing expedition.

  11. Maria

    The problem is that the more you use the same data to generate hypotheses and then test those hypotheses, the harder it becomes to control error rates for the final analysis. A chance pattern may look like a statistically confirmed finding. This concern is connected to research on false discoveries, including the famous argument that many published findings may be false and studies estimating false discovery rates in medical literature.

  12. Simon

    So exploratory work is valuable, but its role must be acknowledged. A discovery made through EDA can motivate a later confirmatory study, ideally with appropriate planning and data. What you should not do is disguise extensive exploration as if it were a single pre-specified test.

  13. Maria

    A useful breakdown of the EDA process begins with reading in the data. Then you figure out what the data contain: what the columns mean, how the datasets relate to one another, and whether the dimensions make sense.

  14. Simon

    Next comes preprocessing. You inspect the values, make tables, search for strange entries, determine how missing data are coded, and ask how much data are missing and whether that coding is consistent. After that, you make lots of plots, because plots are the cornerstone of EDA. The final step is simple to state but difficult to practice: don't fool yourself.

  15. Maria

    Preprocessing is not merely administrative work. Jenny Bryan emphasizes the goal of getting data into a rectangle: a well-organized rectangular format with sensible rows and columns. Data wrangling may take a day or two, but that time is part of the analysis, not time spent before the analysis begins.

  16. Simon

    A strong data format is like the foundation of a house. The foundation may not be the exciting part, but without it, everything built afterward is unreliable. A useful rule is that no one regrets getting their data into a well-organized, well-thought-out format.

  17. Maria

    Save the steps you take, use version control such as Git, and work toward reproducible research. Give columns sensible names that work well with software. Avoid spaces, quotation marks, and unusual symbols, and use a consistent naming convention.

  18. Simon

    Keep data separate from presentation features. For example, do not embed graphs inside the basic data table. If you use a spreadsheet, create copies, record how each copy was made, and keep graphs on separate sheets. Also, do not use numbers such as 888 or 999 to represent missing values unless the software will recognize them as missing; otherwise they may be treated as real measurements.

  19. Maria

    That last mistake can seriously distort an analysis. Missing values coded as ordinary numbers, a height or weight entered with an extra zero, or an errant measurement can reverse the apparent direction of an effect. Model diagnostics such as DFFITS and DFBETAS can also help identify influential or problematic observations.

  20. Simon

    There are tools for this work in many environments. In R, packages such as dplyr, tidyr, purrr, and stringr support data wrangling. The specific tool matters less than the principles: inspect the structure, document the transformations, and make the data consistent before interpreting results.

  21. Maria

    Now let's turn to the challenge of not fooling yourself. One illustration is the parable of the blind men and the elephant. Each person touches only one part and concludes that the elephant is a wall, a snake, or something else. The lesson is that the data you observe may provide only an incomplete view of the phenomenon.

  22. Simon

    Another illustration is shooting an arrow and painting a bull's-eye around where it lands. That represents finding a pattern by chance and then pretending it was the hypothesis you intended to test all along. It is closely related to confirmation bias: noticing evidence that supports a preferred idea while overlooking evidence that challenges it.

  23. Maria

    The lamppost story makes a different point. A person drops a quarter in a dark area but searches under a streetlamp because the light is better. In data analysis, we can end up studying only the variables or observations that are easiest to access, rather than asking whether the available data can actually answer our question.

  24. Simon

    Multiplicity is another major danger. If you search through enough variables, subgroups, colors, time points, or possible associations, eventually something may appear significant just by chance. The jellybean-and-acne cartoon captures this: after finding no overall association, investigators examine many jellybean colors until one color seems related to acne.

  25. Maria

    These dangers can be summarized as follows: the data may not answer the question, a true observation may still be incomplete, confirmation bias can make a discovered result look preplanned, chance associations can look meaningful, and repeated searching increases the opportunity for false findings. These problems are especially pronounced in EDA because the process is usually flexible rather than strictly protocolized.

  26. Simon

    This is why plots are so central. Visual information can reveal patterns that a table, a single number, or a written summary hides. A plot can make structure, outliers, missingness, and unusual relationships visible immediately.

  27. Maria

    A famous example is Charles Joseph Minard's graphic of Napoleon's 1812 invasion of Russia. The path shows the troops moving toward Moscow and then retreating. The width of the line represents the number of troops, branches show groups that separated, and the temperature is displayed along the bottom.

  28. Simon

    The graphic begins with about 422,000 troops and ends with roughly 10,000 returning. It combines geography, direction, troop numbers, dates, and temperature in one display, making the losses during the campaign immediately apparent. It is a powerful example of how a carefully designed graph can communicate a complex story.

  29. Maria

    Anscombe's quartet gives another reason to plot data. Four datasets can have the same means, standard deviations, correlation, regression slope, and R-squared value, yet their graphs tell very different stories.

  30. Simon

    One dataset shows a fairly ordinary noisy linear relationship. Another contains a curved pattern, another is almost a perfect line with one outlier, and another has nearly all its variation in a single unusual x-value. If you rely only on numerical summaries, you miss those differences.

  31. Maria

    Residual plots are important for the same reason. Len Stefanski created examples where a regression model appeared acceptable from its coefficients and p-values, but a plot of predicted values against residuals revealed an image of Bob Dylan. The point is not the picture itself; it is that a residual plot can expose structure that the model summary conceals.

  32. Simon

    A major plotting principle from Edward Tufte is to maximize the data-to-ink ratio, or more generally, the amount of information conveyed by the visual material. A plot showing the individual data points along with group summaries can communicate the distribution, spread, and group differences.

  33. Maria

    A bar chart showing only two group means uses a lot of ink to display very little information. It hides the individual observations and their variability. When in doubt, devote ink to data rather than decoration.

  34. Simon

    That is also why ordinary plots should generally avoid three-dimensional effects. The extra perspective, shading, and distortion do not add information and can make comparisons harder. Three-dimensional displays can be appropriate when the object itself is genuinely three-dimensional, such as a brain image, but they should be used carefully.

  35. Maria

    Logarithmic scales are useful when orders of magnitude matter. In genomic data, an unlogged plot can make nearly everything appear to be zero, while a log base 10 scale reveals meaningful variation between groups. Without the log transformation, most of the relevant information may be compressed into a tiny part of the graph.

  36. Simon

    Log transformations can also make relationships easier to compare. A mean-difference plot on the log scale can show the log ratio between two measurements against their average expression level, spreading the data across the display and revealing how variability changes with the average level.

  37. Maria

    Exploratory plots are usually made quickly and in large numbers for personal or team understanding, not immediately polished for publication. Even so, label the axes clearly and include measurement units. In EDA, color and size should primarily communicate information rather than serve as decoration.

  38. Simon

    There is also a psychology of plotting. Human perception is very good at seeing patterns, including patterns that are not real. Optical illusions demonstrate that surrounding shapes or colors can change how we perceive size or tone, even when the underlying values are identical.

  39. Maria

    So visual interpretation is not perfectly objective. When we make one plot, decide what it suggests, make another plot, and continue responding to what we see, we are carrying out a series of informal hypothesis tests. The familiar problems of selective attention and multiplicity still apply, even if no formal p-value has been calculated.

  40. Simon

    Hadley Wickham illustrated this idea by comparing real data with permuted data. If patterns appear just as often in the permuted examples as in the real data, that gives a visual way to think about whether the observed structure might be noise.

  41. Maria

    Bill Cleveland's work helps explain why some graphs are easier to interpret than others. He studied perceptual tasks such as comparing lengths, angles, directions, areas, volumes, curvature, shading, and positions on common or different scales.

  42. Simon

    People generally do best when comparing positions on a common scale, much like locating two points on the same ruler. Comparisons become harder when items are separated, placed on different scales, or represented by angles, areas, volumes, or slopes.

  43. Maria

    That research helps explain why pie charts are difficult to interpret: comparing slice angles is a poor perceptual task. Comparing slopes can also be difficult, and squeezing or stretching a plot changes how easily people estimate them.

  44. Simon

    Even the apparent strength of a correlation can depend on the scale of a scatterplot. People may estimate the same correlation differently when the plot is zoomed or rescaled, and visual estimates tend to be least accurate for moderate correlations rather than correlations near zero or one.

  45. Maria

    The encouraging point is that people can improve. Research using students in online courses found that people initially struggled to judge relationships or significance from scatterplots, but training improved their performance. Good graphical interpretation is partly a learned skill.

  46. Simon

    The practical rules are straightforward: use common scales whenever possible, favor position comparisons, be cautious with angles and slopes, avoid unnecessary three-dimensional effects, and do not treat visual impressions as unquestionable evidence.

  47. Maria

    And avoid overcorrecting in the other direction. The goal is not to eliminate every false positive by declaring that nothing is ever meaningful. The goal is to use a sound compass: investigate openly, recognize uncertainty, and avoid overstating what the data support.

  48. Simon

    For software, Brian uses R and described both base R graphics and ggplot. The grammar-of-graphics approach behind ggplot encourages you to organize the data carefully before plotting, then provides a flexible way to construct visualizations.

  49. Maria

    Interactive graphics are another option. Plotly and Shiny can let viewers use sliders, buttons, or other controls, while D3 is a powerful JavaScript library that requires a larger investment in programming. Still, nearly every major statistical program has adequate graphics capabilities; the principles matter more than the specific tool.

  50. Simon

    For further study, resources include Tukey's work, Roger Peng's practical materials, Tufte's books on design, Cleveland's work on perception and plotting, and materials from researchers such as Karl Broman, Jenny Bryan, Hadley Wickham, and Nathan Yau. EDA can also include regression, clustering, dimension reduction, and other modeling tools when they are being used to generate hypotheses rather than confirm a fixed one.

  51. Maria

    That final point is important: EDA is defined less by a particular technique than by the purpose and style of the analysis. If you are looking for trends, probing the data, and developing hypotheses as you go, you are doing exploratory analysis, whether the method is a plot, regression, clustering, or dimension reduction.

  52. Simon

    And the main lesson is practical as well as philosophical: organize the data carefully, inspect values and missingness, make many informative plots, understand the limits of perception, and be honest about how hypotheses were generated. Exploratory analysis is powerful because it helps us discover what the data may be saying—but it is safest when we remember that discovery is not the same as confirmation.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent