The R Challenge
In Excel, a probabilistic sensitivity analysis needs hundreds of rows of formulas. In R:
The worst global recession since the 1930s. Banks failed, unemployment soared, governments borrowed massively to stimulate their economies.
Should governments keep spending to boost growth — or slash spending to reduce dangerous debt levels? The debate was fierce.
Policymakers desperately wanted data. At what point does government debt become so large that it chokes off growth?
Harvard University, American Economic Review
Countries whose government debt exceeds 90% of GDP experience dramatically lower economic growth — averaging just -0.1% per year.
Cited 3,000+ times.
"The recent research of economists Carmen Reinhart and Kenneth Rogoff confirms that high levels of government debt consistently lead to lower economic growth."
— Paul Ryan, U.S. House Budget Committee, 2013 Budget Proposal
Imposed austerity on Greece, Spain, Portugal, Ireland as condition of bailouts.
Chancellor Osborne used it to defend sweeping welfare and public service cuts.
Cited in country reports recommending fiscal consolidation across debt-heavy nations.
Informed Republican budget plans targeting trillions in spending reductions.
| 01 | The assignment — Professor asked students to replicate a famous economics paper. He chose Reinhart-Rogoff. |
| 02 | The mismatch — His results didn't match. He ran the numbers again. And again. Still wrong. |
| 03 | The email — He emailed Reinhart and Rogoff directly and politely asked for their original Excel file. |
| 04 | The moment — They sent it. What he found inside would become one of the most famous discoveries in economics. |
Original Claim
Growth above 90% debt:
per year average
Debt above 90% causes contraction
Corrected Result
Growth above 90% debt:
per year average
Slower growth — but not economic collapse
Toggle countries in and out to see how the conclusion changes.
Research that shapes policy must be verifiable. Journals now require raw data and code.
An off-by-one range error became the most expensive typo in economic history.
No policy affecting millions should rest on a single unreviewed spreadsheet.
Institutions adopt what confirms their priors — and resist correction fiercely.
Thomas Herndon did what no senior economist had bothered to do. It took 3 years.
mean(df$growth)
always uses ALL rows
| Criterion | Excel | R |
|---|---|---|
| Reproducibility | Cell references hidden; copy-paste errors common | Script = complete audit trail |
| PSA (10,000 sims) | Thousands of rows, slow, crash-prone | 3 lines of R, < 1 second |
| Markov Models | Drag formulas across states x cycles | Matrix multiplication: 1 line |
| Sensitivity Analysis | Manual data tables, limited dimensions | Loops + parallel computing |
| Visualization | Basic charts, limited customization | ggplot2, plotly, Shiny dashboards |
| Collaboration | Email attachments, version confusion | Git + GitHub, branching, code review |
| Cost | Licence fee (Rs. 5,000-15,000/year) | Free & open-source, forever |
| Regulatory Acceptance | Common but scrutinized for errors | NICE, HTAIn, WHO — all accept R |
Over the next 3 days, you will build every model type shown in this app — from scratch, in R. No prior R experience required.