Syllabus

Course description
Introduction to applied statistical modeling in a Bayesian framework. Topics will include probability, regression, model comparison, and hierarchical modeling. We will take a hands-on, computational approach (R, Stan) to gain intuition so that students can later design their own inferential models. Prerequisites for this course include introductory statistics and previous exposure to scientific computing. Open to graduate students or undergraduate students with consent of instructor.

We will meet for 1.5 hours, twice a week. Classroom activities will be a mix of lecture, discussion, and collaborative problem solving. Outside of class, students will read selected chapters, solve problem sets, and complete an independent project. All participants in the course will abide by the Code of Conduct, described below.

Instructor
Dr. Robin Elahi

Times and location
12:30 PM - 1:50 PM; T, Th
This course will be held remotely on zoom; link is provided on the canvas website

Drop-in hours
12:00 PM - 12:30; T, Th
You can also email to schedule an appointment:
elahi at stanford

Course website
All materials will be accessed through https://canvas.stanford.edu/

Learning objectives

This course is a practical introduction to generalized linear modeling in a Bayesian framework. By the end of the course, students will be able to:

  1. Understand the basics of probability and probability distributions necessary for Bayesian inference
  2. Describe the components of Bayes theorem and their relevance for model specification
  3. Diagram a Bayesian network; translate the network into a mathematical expression; translate into R code using rethinking
  4. Apply a hierarchical (generalized) linear model to their own data

Schedule

Week Topic
1 Introduction to Bayesian modeling
2 Probability rules
3 Sampling the posterior distribution
4 Probability distributions, likelihood
5 Linear and multiple regression
6 Markov chain Monte Carlo
7 Generalized linear models
8 Multi-level models
9 Student projects, directed reading
10 Student presentations

A more detailed schedule is here.

Evaluation and grading

Here is a breakdown of graded tasks:

  • Participation (10%)
  • Labs (30%)
  • Project overview (10%)
  • Project analytical methods (15%)
  • Project draft report (5%)
  • Project final report (20%)
  • Project presentation (5%)
  • Project peer interactions (5%)

Assignments and projects are due at 12pm on the due date. Late assignments will be penalized 10% per day. Final grades will be assigned based on the Stanford general grading system.

Course texts

Primary text

Statistical Rethinking, 2nd edition (McElreath; 2020):
http://xcelab.net/rm/statistical-rethinking/

Book can be accessed here via Stanford’s library:
https://searchworks.stanford.edu/view/13631911

McElreath’s lecture slides are here and videos of lectures here [from 2019]

Secondary text

Bayesian Models : a Statistical Primer for Ecologists (Hobbs and Hooten; 2015):
https://press.princeton.edu/books/hardcover/9780691159287/bayesian-models

Book can be accessed here via Stanford’s library:
https://searchworks.stanford.edu/view/13753652

Attribution

The lectures and labs are based on the above texts. I also adapt some material from the Bayesian Modeling for Socio-Environmental Data Short Course taught by Tom Hobbs, Mary Collins, and Christian Che-Castaldo at SESYNC.

Before Class

R and RStudio

Before the first class please read through the computer setup instructions that walk you through how to set up your computer to run R and Rstudio. Even if you have these programs already installed, make sure to check that you are running the latest versions of R and RStudio (which the instructions will tell you how to do).

If you are unfamiliar with R and RStudio:
Intro to R & RStudio
Intro to R markdown

Software for Bayesian inference

To fit our models, we will be using the rethinking package by Richard McElreath, which depends on Stan and RStan - see here for installation.

Code of conduct

I will maintain a respectful environment where everyone can engage in an open discussion and bring their strengths and weaknesses to the table without apprehension. Any behavior that detracts from these goals will not be tolerated.

Expected behavior includes (but is not limited to):

  • Treating all participants with respect and consideration.
  • Communicating openly with respect for others, critiquing ideas rather than individuals.
  • Avoiding personal attacks directed toward others.

Unacceptable behavior includes (but is not limited to):

  • Behavior that implies or indicates that someone does not belong in the class based on any personal characteristic or identity.
  • Any unwanted attention, sexual advances, and comments about appearance.
  • Verbal harassment, including comments, epithets, slurs, threats, and negative stereotyping that are offensive, hostile, disrespectful, or unwelcome.
  • Non-verbal harassment, including actions or distribution, display, or discussion of any written or graphic material toward an individual or group that ridicules, denigrates, insults, belittles, or shows hostility, aversion, or disrespect.
  • Bullying, intimidation, stalking, shaming, and assault.
  • Retaliation for reporting harassment.
  • Reporting an incident in bad faith.

Notes

Depending on our progress, I may change the schedule and/or topics to meet class needs. You will be notified of any changes.

Plagiarism, Dishonesty, and Academic Misconduct

It is expected that Stanford’s Honor Code will be followed in all matters relating to this course. You are encouraged to meet and exchange ideas with your classmates while studying and working on homework assignments, but you are individually responsible for your own work and for understanding the material. Passing anyone else’s scholarly work, which can include: written material, computer code, exam answers, graphics or other images, and even ideas as your own, without proper attribution, is considered academic misconduct.

Plagiarism, cheating, and other misconduct, including bullying, discrimination, and harassment, are serious violations of the University’s Fundamental Standard and Honor Code:

https://communitystandards.stanford.edu/policies-and-guidance

Affordability of Course Materials

Stanford University and its instructors are committed to ensuring that all courses are financially accessible to all students. If you are an undergraduate who needs assistance with the cost of course textbooks, supplies, materials and/or fees, you are welcome to approach me directly. If would prefer not to approach me directly, please note that you can ask the Diversity & First-Gen Office for assistance by completing their questionnaire on course textbooks & supplies: http://tinyurl.com/jpqbarn or by contacting Joseph Brown, the Associate Director of the Diversity and First-Gen Office (; Old Union Room 207). Dr. Brown is available to connect you with resources and support while ensuring your privacy.

Students with Documented Disabilities

Students who may need an academic accommodation based on the impact of a disability must initiate the request with the Office of Accessible Education (OAE). Professional staff will evaluate the request with required documentation, recommend reasonable accommodations, and prepare an Accommodation Letter for faculty. Unless the student has a temporary disability, Accommodation letters are issued for the entire academic year. Students should contact the OAE as soon as possible since timely notice is needed to coordinate accommodations. The OAE is located at 563 Salvatierra Walk (phone: 723-1066, URL: https://oae.stanford.edu/).

Roles and Responsibilities

Student: inform the instructor no later than the first week of the quarter of any accommodation(s) you will or may potentially require.
Instructors: maintain strict confidentiality of any student’s disability and accommodations; help all students meet the learning objectives of this course.