Margin of Error

Statistics for a World That Needs Better Decisions

Every chapter opens with a real story — poisoned water in Flint, Facebook’s secret mood experiment, the night the polls “failed.” Learn statistics through the cases that prove why it matters.

Buy on Amazon Read Chapter 1 Free

Twelve Chapters. Twelve Real Stories.

Click any chapter to learn more.

1 Why Statistics Matters Now The water in Flint was poisoned. Statistics proved it.

In 2014, the water in Flint, Michigan was poisoned. Officials said it was safe. Two researchers — two datasets, two statistical analyses — forced the truth into the open.

What you'll learn:

  • What statistics is (and is not)
  • Variables, data types, and levels of measurement
  • How to read and critique data summaries
  • Why context matters more than calculations

Dataset: flint-water-lead.csv · Key Concept: Statistical thinking

2 Asking Good Questions Facebook manipulated 689,000 users' emotions. Nobody consented.

In 2012, Facebook quietly altered the News Feeds of 689,000 users to test whether emotional content could change their moods. The results were modest. The backlash was volcanic.

What you'll learn:

  • Observational vs. experimental studies
  • Populations and samples; sampling methods
  • Bias, confounding, and ethics

Tool: Sampling Explorer · Dataset: sampling-demo.csv · Key Concept: Research design determines what you can conclude

3 Summarizing Data with Numbers The mean says $105K. The median says $75K. Same data.

The mean U.S. household income says $105,000. The median says $75,000. Same data, same country, thirty-thousand-dollar gap. Whichever number a politician reports tells you more about their agenda than about the economy.

What you'll learn:

  • Mean, median, and mode
  • Standard deviation, IQR, and range
  • Skewness and outliers
  • Choosing the right summary for the shape of your data

Dataset: income-inequality.csv · Key Concept: Summary statistics are choices, not facts

4 Summarizing Data with Pictures 1930s maps colored neighborhoods by race. The damage persists today.

In the 1930s, federal agents color-coded American neighborhoods — green for "best" (white), red for "hazardous" (Black). Eighty years later, 74% of those redlined neighborhoods are still low-income.

What you'll learn:

  • Histograms, boxplots, bar charts, and scatter plots
  • Correlation vs. causation
  • How visualizations can mislead

Tool: Correlation Game · Dataset: housing-redlining.csv · Key Concept: Visualization reveals what tables hide

5 Probability Your COVID test is positive. The chance you actually have it? About 15%.

Your COVID test is positive. The test is 90% accurate. So there's a 90% chance you're infected, right? Wrong. In a low-prevalence population, the real probability was about 15%.

What you'll learn:

  • Probability rules and conditional probability
  • Bayes' theorem
  • The base rate fallacy

Tool: Distribution Explorer · Dataset: covid-testing.csv · Key Concept: Bayes' theorem

6 Normal Distribution & CLT Every baby gets weighed. The bell curve decides what happens next.

Within minutes of being born, every baby gets weighed. That number gets compared against a distribution. If the baby falls in the tails, clinical decisions happen fast.

What you'll learn:

  • Normal distribution properties and z-scores
  • The empirical rule (68-95-99.7)
  • The Central Limit Theorem

Tool: Distribution Explorer · Dataset: birth-weights.csv · Key Concept: The Central Limit Theorem

7 Confidence Intervals The 2016 polls were not wrong. We just read them wrong.

On election night 2016, the polls "failed." Except they didn't. Clinton +3 with a margin of error of ±4 meant Trump +1 was always within the range.

What you'll learn:

  • Point estimates vs. interval estimates
  • Constructing CIs for means and proportions
  • What "95% confidence" actually means

Tool: CI Simulator · Dataset: polling-data.csv · Key Concept: Margin of error

8 Hypothesis Testing A letter about your energy use saved 2%. Was it real or random?

Opower sent 10 million households a letter comparing their energy use to their neighbors'. Usage dropped 2%. Was it real — or noise?

What you'll learn:

  • Null and alternative hypotheses
  • Test statistics and p-values
  • Type I and Type II errors; statistical power
  • P-hacking and the replication crisis

Tools: Hypothesis Playground, P-Hacking Simulator · Dataset: energy-reports.csv · Key Concept: P-values and their misinterpretation

9 Comparing Groups Identical resumes, different names. A 50% gap in callbacks.

Economists sent 5,000 identical resumes to real job postings. The only difference: half had names like Emily and Greg, half had names like Lakisha and Jamal. White-sounding names received 50% more callbacks.

What you'll learn:

  • Two-sample t-tests and ANOVA
  • Post-hoc comparisons (Tukey) and effect sizes
  • Ethics of group comparison research

Tool: ANOVA Visualizer · Dataset: resume-callbacks.csv · Key Concept: Comparing group means

10 Simple Linear Regression Does spending more on schools actually improve test scores?

Per-pupil spending on one axis, test scores on the other, one dot per state. Advocates see a trend. Skeptics see noise.

What you'll learn:

  • The least-squares line; slope and intercept
  • R-squared and residual analysis
  • Assumptions and diagnostics

Tool: Regression Explorer · Dataset: education-spending.csv · Key Concept: Fitting a line through the noise

11 Multiple Regression The gender wage gap is 79 cents. Or is it? Depends what you control for.

The average woman earns 79 cents for every dollar a man earns. "Control for occupation and experience," one side says, "and the gap nearly vanishes." "You can't control for occupation," the other replies, "when occupation itself reflects discrimination."

What you'll learn:

  • Multiple predictors and partial slopes
  • Interaction terms and multicollinearity
  • What "controlling for" really means — and its limits

Tool: Regression Explorer · Dataset: wage-gap.csv · Key Concept: What "controlling for" really means

12 Where Do You Go from Here? Time series, machine learning, Bayesian thinking. Your road ahead.

You have learned to read data, quantify uncertainty, and test claims. This final chapter is a roadmap — a guided tour of the statistical landscape that lies ahead.

What you'll learn:

  • Time series and seasonality
  • Machine learning (logistic regression, train/test split)
  • Bayesian thinking (updating beliefs with data)
  • Where to go next

Key Concept: The road ahead

Read Chapter 1 free Buy the Book


Why This Book Is Different

Most statistics textbooks start with formulas and end with homework problems about widgets. Margin of Error starts with stories that matter and ends with the tools to interrogate them.

  • Stories first, formulas second. Every chapter opens with a case where statistics changed what people believed — from the Flint water crisis to the resume discrimination study.
  • Interactive tools you won’t find elsewhere. Eight purpose-built Shiny applications let you explore sampling, confidence intervals, hypothesis testing, p-hacking, and regression in real time.
  • R code for every chapter. Complete R walkthroughs show you how to reproduce every analysis in the book, step by step.
  • Built for thinking, not memorizing. No calculus prerequisite. No formula sheets. Statistical reasoning as a mode of thought you will use long after the final exam.

What Comes With the Book

12 Case Studies

Every chapter opens with a real story — from the Flint water crisis to the gender wage gap debate. The statistics serve the story, not the other way around.

8 Interactive Tools

Explore sampling distributions, confidence intervals, hypothesis testing, ANOVA, and regression — right in your browser. No installation required.

12 Datasets

Every case study comes with downloadable data. Practice with the same numbers the book analyzes. CSV files ready for R, Python, or Excel.

12 R Walkthroughs

Complete R code for every chapter. Load the data, run the analysis, build the visualizations. Step by step, fully annotated.


About the Author

Vivek H. Patil, Ph.D. is a Professor of Marketing at Gonzaga University with over two decades of experience in research and teaching. He has taught business analytics, multivariate statistics, and marketing research. He founded Margin of Error Media to publish the kinds of books he wished existed when he started teaching — rigorous but accessible, grounded in real stories, and paired with tools that make abstract ideas concrete.


Get Your Copy

Print Edition — $39.99 Buy on Amazon

Kindle Edition — $14.99 Buy on Amazon

For Instructors

Exam banks, sample syllabi, and other instructor materials are available on request. Contact patilv@gmail.com.