GelmanHill icon indicating copy to clipboard operation
GelmanHill copied to clipboard

Examples and data from Gelman & Hill 2007

Gelman and Hill (2006)

Examples and data for the classic textbook Gelman and Hill (2006).

Notebooks

A notebook file contains the code, output and formatted comments for an R script. As I work through the examples, I save notebooks.

  • Chapter 7
    • 07-01 Simulating Probability Models
    • 07-02 Summarizing Linear Regression Using Simulation
    • 07-03 Simulation for Nonlinear Predictions

BUGS vs. Stan

I created this repository so that I could work through the book's examples as an RStudio project. Things have become slightly more complicated: The BUGS code in the book is effectively unsupported (in favor of Stan).

I originally downloaded the materials from Gelman's page and stored them in this repository. These files used BUGS for model fitting, so they represent the canonical computing materials for the first edition of the book (2006).

Gelman's instructions page for BUGS is now titled "Use Stan instead", so I'll be using Stan/RStan instead. Fortunately, Stan materials for the book were available, and I've replaced the BUGS examples with Stan examples. These Stan examples are from circa 2015.

I'm taking the liberty to modify examples and rename files as I work through them. I've tagged the commits with unmodified versions of the original BUGS examples and original Stan examples so that those are readily available.