Skip to content

Instantly share code, notes, and snippets.

View SermetPekin's full-sized avatar

Sermet Pekin SermetPekin

View GitHub Profile
@SermetPekin
SermetPekin / SingleFile.R
Last active October 23, 2025 05:40
Fully reproducible R and Stan script for Andrew Gelman’s “Reanalysis of that Nobel prize–winning study of patents and innovation”
# Reproduction of Andrew Gelman's blog post:
# "Reanalysis of that Nobel prizewinning study of patents and innovation (with R and Stan code)"
# https://statmodeling.stat.columbia.edu/2025/10/21/reanalysis-of-that-nobel-prizewinning-study-of-patents-and-innovation/
# This script installs packages, downloads data, compiles Stan models, and reproduces plots in one run.
# ---- install-and-load ------------------------------------------------------
# Packages you need
pkgs <- c("haven", "arm", "rstanarm", "MASS", "cmdstanr")
# Ensure pak is available (fast, respects binaries)