Beyond Reproducible Research: Building a Formal Representation of a Data Analysis

This paper argues for and presents an implementation of a formal representation of data analysis that externalizes an analyst's logical reasoning and assumptions, thereby enabling evaluation, visualization, and sensitivity testing of conclusions without relying solely on executable code or raw data.

Roger D. Peng

Published Thu, 12 Ma
📖 6 min read🧠 Deep dive

Imagine you are a chef who has just created a delicious new soup. You write down the recipe (the code) and list the ingredients (the data). You hand this to a friend and say, "Here, try to make this soup exactly like I did." This is the current standard for Reproducible Research.

However, there's a problem. Your friend might follow the recipe perfectly, but they still don't know why you chose those specific ingredients.

  • Did you add salt because you wanted it salty, or because you thought the tomatoes were too acidic?
  • Did you ignore the burnt carrots because you thought they were just "roasted," or because you didn't notice them?
  • What if the soup tastes weird because you used a specific type of water that you didn't mention?

The recipe (code) tells them what you did, but it hides why you did it and what you were expecting to happen.

The Problem: The "Black Box" of Data

In the world of data science, researchers often just share their code and the final numbers. If the code runs without crashing, everyone assumes the result is correct. But this is like judging a magic trick just because the rabbit appeared. You don't know if the magician actually pulled the rabbit out of a hat or if they had a second rabbit hidden in their sleeve.

If the data has a hidden flaw (like a missing number or a weird outlier), the code might still run, but the conclusion could be wrong. Because the code doesn't explicitly state the researcher's assumptions (e.g., "I assume there are no missing numbers"), these errors can slip through silently.

The Solution: The "Logical Blueprint"

Roger Peng, the author of this paper, proposes a new way to share data analysis. Instead of just sharing the "recipe," he suggests sharing a Logical Blueprint or a Proof.

Think of it like building a house.

  • Current Method: You show someone the finished house and the list of tools you used. They can try to build it, but they don't know if the foundation is solid or if you skipped a step because you "thought" the ground was level.
  • Peng's Method: You give them a blueprint that says: "To build this roof, we first proved the foundation is flat. To prove the foundation is flat, we checked that the ground has no holes. To prove there are no holes, we shined a light on the ground."

In this new system, every claim you make (e.g., "The average height is 5 feet") must be backed up by a chain of evidence. You have to explicitly state:

  1. The Claim: "The average is 5 feet."
  2. The Premise: "This is true ONLY IF there are no missing numbers."
  3. The Evidence: "I checked the data, and there are indeed no missing numbers."

How It Works (The "Class" System)

The paper uses a programming concept called "Classes" (which you can think of as Identity Badges).

Imagine every statement you make in your analysis gets a badge.

  • Badge A: "No Missing Numbers."
  • Badge B: "No Extreme Outliers."
  • Badge C: "The Average is 5 Feet."

In Peng's system, you cannot wear Badge C (The Average is 5 Feet) unless you are also wearing Badge A and Badge B. The code forces you to check for the missing numbers and outliers before you are allowed to claim the average.

If the data has missing numbers, the system simply refuses to give you the "Average is 5 Feet" badge. It stops you from making a false claim.

Why Is This Better?

1. You Don't Need the Data to Check the Logic
With the old method, to check if a study is right, you have to download the massive dataset and run the code again. It's like having to bake the whole cake just to see if the recipe makes sense.
With Peng's blueprint, you can look at the "Logical Tree" and see: "Ah, they claimed the average is 5 feet. They said this is only true if there are no outliers. But wait, their data does have outliers! Therefore, their claim is unsupported." You can spot the flaw without ever seeing the actual data.

2. It Stops "Silent Errors"
Sometimes, data is messy. Maybe "USA" is written as "US" in one file and "USA" in another. A computer might join them and accidentally delete half the data, but it won't scream an error; it will just give you a wrong answer.
In Peng's system, you would have a badge that says "The joined file must have 100 rows." If the join fails and you only get 50 rows, the system screams, "ERROR! You don't have the right badge!" It forces you to fix the data before you can proceed.

3. It Visualizes the Reasoning
The paper suggests drawing a tree diagram of these badges.

  • Top Branch: "The Drug Cures the Disease."
  • Middle Branch: "Because the patients improved."
  • Bottom Branch: "Because the patients didn't have other illnesses" AND "Because the measurement tool was accurate."

If you look at the tree, you can instantly see if the logic holds up. If one of the bottom branches is weak, the whole tree falls over.

The Catch

The author admits this is a lot of work. Writing these "badges" and "proofs" takes more time and code than just writing a simple script. It's like writing a legal contract for every step of your cooking. It's verbose and tedious.

However, the paper argues that this extra effort is worth it. It forces scientists to think clearly about what they are doing, exposes their assumptions, and makes it much harder to hide mistakes. It turns data analysis from a "black box" into a transparent, logical argument that anyone can inspect, even without running the code.

Summary

  • Old Way: "Here is my code and my result. Trust me, it works."
  • New Way: "Here is my result. Here is the logical proof that the result is valid, including every assumption I made and every check I performed. If you check my logic, you will see why this result is true."

It's the difference between a magician saying "Abracadabra!" and a scientist showing you the hidden trapdoor, the spring mechanism, and the proof that the rabbit was never actually in the hat to begin with.