GithubHelp home page GithubHelp logo

gavin-ng / statistical_rethinking_with_brms_ggplot2_and_the_tidyverse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from askurz/statistical_rethinking_with_brms_ggplot2_and_the_tidyverse

0.0 2.0 0.0 463.52 MB

Reexpress McElreath’s "Statistical Rethinking" (2015) by fitting the models in brms, plotting with ggplot2, and data wrangling with tidyverse-style syntax.

statistical_rethinking_with_brms_ggplot2_and_the_tidyverse's Introduction

Statistical Rethinking with brms, ggplot2, and the tidyverse

This is a love letter

I love McElreath’s Statistical Rethinking text. It's the entry-level textbook for applied researchers I spent a couple years looking for. McElreath's freely-available lectures on the book are really great, too.

However, I've come to prefer using Bürkner’s brms package when doing Bayeisn regression in R. It's just spectacular. I also prefer plotting with Wickham's ggplot2, and recently converted to using tidyverse-style syntax (which you might learn about here or here).

So, this project is an attempt to reexpress the code in McElreath’s textbook. His models are re-fit in brms, plots are reproduced or reimagined with ggplot2, and the general data wrangling code now predominantly follows the tidyverse style.

This project is not meant to stand alone. It's a supplement to the textbook. Starting with chapter 4--except chapter 9, which doesn't have any models--, each chapter from Statistical Rethinking has its own document available in either an R Notebook file or the corresponding HTML document. The flow matches closely to the book, but once in a while I add a little something extra. For example, the end of the chapter 5 files digress on the Bayesian R squared. I also devote some space at end of the chapter 6 files to highlight the brms::marginal_effects() function.

I also play around with the plots, quite a bit. The plots in the chapter 4 documents most closely mirror those in the text. I take more liberties in the other files. This is particularly aimed at newer ggplot2 users, to give them a sense of what's possible.

Disclaimer: brms is a rapidly-evolving package. To get a sense, see how frequently Bürkner has updated some of the most recent versions. I also have a lot to learn as a Bayesian and as an R user. So some of the code may appear dated or inelegant and I'm not yet sure how to reproduce some of the models/plots in the text. Which is all to say, suggestions on how to improve my code are welcome.

Happy modeling!

statistical_rethinking_with_brms_ggplot2_and_the_tidyverse's People

Contributors

hammer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.