Zum Inhalt springen

Lektion 20 · Pitfalls and Checks

Common EDA Pitfalls

Recognize selection bias, survivorship bias, regression to the mean, the base-rate trap, leakage and the many-comparisons problem before they mislead you.

Your code can be correct while your conclusion is wrong. Many serious mistakes in exploration come from how the data came to exist and how you searched it. This lesson collects traps that catch beginners and experts alike.

Selection bias

Selection bias happens when the rows you have differ systematically from the population you care about. A feedback form reaches people who choose to answer. App analytics cover only people who use the app. A table of approved loans says nothing directly about how rejected applicants would have repaid.

Always ask: How did a case get into this table? Who is missing?

Survivorship bias

Survivorship bias is a special kind: you only see what survived. If you study current customers to learn why people love your service, you miss everyone who left.

Python Only the survivors look great

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Every fund here follows the same luck-only process. The survivors look skilled because the bad histories were removed. The data is invented and says nothing about real investments.

Regression to the mean

When a measurement includes luck, extreme results tend to be followed by results closer to average. This is regression to the mean. If you give extra training to last month's worst performers, many may improve even if the training does nothing.

Python The worst improve, without any help

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

To judge an intervention, compare with a similar group that did not receive it, ideally assigned at random.

Base rates

A base rate is how common something is in the first place. When something is rare, even a good detector can produce mostly false alarms.

Python A good detector, mostly false alarms

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Many comparisons

If you check enough segments, dates and variables, something will probably look remarkable by chance. Trying options until one works, then reporting only that one, is often called p-hacking. The garden of forking paths describes a related problem: many small analysis choices, made after seeing the data, can lead to a pleasing result even without deliberate searching. Protect yourself:

  • Write your main questions before you look.
  • Count how many comparisons you made and report that number.
  • Hold back part of the data, or wait for new data, to check a discovery.
  • Use corrections for multiple tests when you do formal testing; see multiple testing.

More traps

Quick trap list

Ecological Group patterns may not fit people
Small samples Extremes by chance
Leakage Future or outcome information
1 / 2

The ecological fallacy means drawing conclusions about individuals from group-level data. If regions with more libraries have higher incomes, that does not show that library visitors earn more.

Goodhart's law is often summarized like this: when a measure becomes a target, it stops being a good measure. If agents are judged on closing tickets quickly, some tickets may be closed too early.

Misleading charts

During exploration your own charts can fool you: a truncated bar axis, two y-axes scaled to make lines match, uneven time spacing, a smoothed line that hides gaps, or different axis ranges in panels meant for comparison.

A pre-conclusion checklist

Before you state a finding, ask:

  1. Who or what is missing from this data?
  2. Could luck or regression to the mean explain it?
  3. How rare is the thing being flagged?
  4. How many things did I try?
  5. Could a third variable or the selection process create it?
  6. Would the same rule give a similar answer on next month's data?

The most dangerous result is the one you hoped to find. Give it the strictest check, and ask a colleague to try to disprove it.

A short story about stacked traps

Suppose a team notices that users of a new feature stay longer. Several traps can act at once. Engaged users are more likely to try new features (selection). Users who left early never had the chance to try it (a survival effect, closely related to what researchers call immortal time bias). The team looked at twenty features and reports the best one (many comparisons). The raw association may be real and still say nothing about what the feature does. This story is invented, but the structure is worth remembering.

A better approach is to define the groups at the same point in each user's life, compare users who were similar before that point, and, where practical, test the feature with a randomized experiment.

Try it yourself

In the survivorship example, change the closing rule to a limit of -20 and then -5. Predict how the number of survivors and their mean return will change. Why does a stricter rule make the survivors look more impressive?

Practice spotting traps

Read each claim and name at least one trap before you accept it. "Our most loyal users all use dark mode, so dark mode builds loyalty." "The five worst branches improved after we emailed them." "We checked 40 segments and found one where the new price works." For each, write what extra data or comparison you would need. This habit of arguing against a claim is quick, and it works for your own conclusions too.

When you find a trap

Finding a bias does not always make the data useless. It may narrow the claim. A survey of current customers can still describe current customers, as long as you do not present it as the view of everyone who ever signed up. Say who your result covers, who it leaves out and in which direction the gap might push the result, if you have good reason to expect one.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. You survey only current subscribers about satisfaction. What bias is a concern?

    Unhappy former customers cannot answer.
  2. 2. The weakest stores improve the month after a visit from managers. What else could explain it?

    Extreme results often move toward average without any intervention.
  3. 3. Why can a detector with high sensitivity still raise mostly false alarms?

    A small false-alarm rate on a huge negative group gives many false flags.
  4. 4. Which habit best reduces false discoveries?

    Planning and independent confirmation limit chance findings.

Summary

  • Ask how cases entered the data and which ones are missing.
  • Survivorship bias and regression to the mean can imitate success.
  • Rare events can make false alarms common.
  • Many comparisons create chance patterns, so report what you tried.
  • Check your favorite result hardest.

Next: Sanity Checks and Uncertainty

Dein Fortschritt wird in diesem Browser gespeichert. Kein Konto nötig.