This course offers an introduction to advanced topics in statistics with the focus of understanding data in the behavioral and social sciences. We will cover a range of methods such as regression, mixed effects models, and generalized linear models. You will learn how these methods work, as well as how to implement them using the statistical computing environment R. In addition to these more traditional methods for analyzing data, we will also discuss simulation methods (e.g. Monte Carlo, bootstrapping), and Bayesian statistics.


Team

 Tobi Gerstenberg Andrew Lampinen Shao-Fang (Pam) Wang Mona Rosenke
Tobias Gerstenberg Andrew Lampinen Pam Wang Mona Rosenke
Role: Instructor Teaching assistant Teaching assistant Teaching assistant
Email: gerstenberg@stanford.edu lampinen@stanford.edu shaofang@stanford.edu rosenke@stanford.edu
Office: 302 316 409 424
Office hours: Monday 2-3pm Friday 12:30-1:30pm Wednesday 1-2pm Tuesday 1:00-2:00pm
Section: Friday 1:30-2:20pm
in 160-314
Wednesday 2:30-3:20pm
in 160-326

Where and when?

Lectures: The class meets Monday, Wednesday, and Friday 10:30-11:50am in 200-203 in the History Corner.

Getting ready

Here is what you need to get ready for class.

Getting started with R

Sign up for these tools

Canvas:

  • course canvas site
  • assignments will be posted here
  • use NameCoach so that we know how to pronounce your name
    • we, the teaching team, affirm people of all gender expressions and gender identities
    • if you prefer to be called a different name than what is indicated on the class roster, please let us know
    • feel free to correct us on your preferred gender pronoun
    • if you have any questions or concerns, please do not hesitate to contact us

Piazza

  • forum for discussing lectures and assignments
  • we will send you the access code via Canvas

Datacamp

  • free online interactive tutorials available to students in class
  • we will send you a sign-up link that will give you free access to all of Datacamp via Canvas

PollEverywhere

  • used for responding to short quizzes and polls in class
  • you will need a computer or device that enables you to respond during every class session
  • we will help you with setting up in the first class
  • our polls will be posted here: www.pollev.com/psych252

Schedule

Week Day Date Topic Content Reading Resources Datacamp
1 M 7-Jan Introduction • Course introduction Cheatsheet R Studio
Cheatsheet R Markdown 1
Cheatsheet R Markdown 2
R Markdown for class reports
Introduction to R
RStudio IDE 1
RStudio IDE 2
RMarkdown
W 9-Jan Visualization I • Best practices
• Introduction to RStudio
• Introduction to library(ggplot2)
• Reporting results using Rmarkdown
Data visualization (#1)
Data visualization (#3)
Cheatsheet ggplot2 ggplot part 1
ggplot part 2
Reporting
F 11-Jan Visualization II • Making nice plots
Data visualization (#4)
Data visualization (#8)
R for Data Science (#27)
Cheatsheet shiny ggplot part 3
Shiny 1
Shiny 2
2 M 14-Jan Data wrangling I • Introduction to library(dplyr)
• Data manipulation
select(), filter(), arrange(), mutate()
R for Data Science (#9-15) Cheatsheet base R
Cheatsheet data tansformation
dplyr
tidyverse
cleaning data
cleaning data: case studies
Tue 15-Jan Homework 1 due at 8pm • Visualization
W 16-Jan Data wrangling II group_by(), summarize()
gather(), spread()
• Joining tables, left_join()
• Read and save data
R for Data Science chapters (#17-21)
Data visualization (#5)
Cheatsheet strings
Cheatsheet data import
joining tables
writing functions
importing data 1
importing data 2
F 18-Jan Probability • Introduction to probability theory
• Conditional probability
• Bayes’ rule
probability puzzles in R
3 M 21-Jan no class (Martin Luther King, Jr. Day)
Tue 22-Jan Homework 2 due at 8pm • Data wrangling & visualization
W 23-Jan Simulation I • Probability distributions
• Generating data
Foundations of Probability in R
F 25-Jan Simulation II • Central limit theorem
• Sampling distributions
• p-values
• Confidence intervals
Foundations of Inference
4 M 28-Jan Modeling data • Hypothesis testing as model comparison
• Errors and parameter estimates
• Statistical inferences about parameters
• Data analysis: A model comparison approach to regression, ANOVA, and beyond (#1-4) statistical modeling 1
Tue 29-Jan Homework 3 due at 8pm • Probability and simulation
W 30-Jan Linear model I • Correlation
• Simple regression
statistical modeling 2
correlation
F 1-Feb Linear model II • Multiple regression
• Interpreting interactions
Data visualization (#6)
5 M 4-Feb Linear model III • Analysis of Variance
• Follow-up tests
modeling
Tue 5-Feb Homework 4 due at 8pm
W 6-Feb Linear model IV • Planned contrasts inference in regression
F 8-Feb Power analysis • Making statistical decisions
• Calculating effect sizes
• Calculating power
Cheatsheet apply functions functional programming
6 M 11-Feb Bootstrapping • Computing confidence intervals
• Visualizing uncertainty
W 13-Feb no class
Midterm due at 12pm (noon)
F 15-Feb Linear model V • Model assumptions
• Model evaluation
• Cross-validation
• BIC, AIC
multiple regression
7 M 18-Feb no class (Presidents’ Day)
W 20-Feb Linear mixed effects model I mixed effects model
Thu 21-Feb Project proposal due at 8pm
F 22-Feb Linear mixed effects model II
8 M 25-Feb Linear mixed effects model III
Tue 26-Feb Homework 5 due at 8pm • Modeling data
W 27-Feb No class
F 1-Mar Generalized linear model • Logistic regression
• Generalized mixed effects model
multiple regression
generalized linear model
categorical data
9 M 4-Mar Bayesian Data Analysis I • Prior, likelihood, posterior Bayesian inference
Tue 5-Mar Homework 6 due at 8pm • Linear mixed effects models
W 6-Mar Bayesian Data Analysis II • Testing hypothesis
F 8-Mar Bayesian Data Analysis III • Comparing models
10 M 11-Mar Course summary and outlook
W 13-Mar Guest lecture: Prof Justin Gardner
Thu 14-Mar Homework 7 due at 8pm • Bayesian data analysis
F 15-Mar Guest lecture: Shao-Fang Wang and Mona Rosenke
Th 21-Mar Final project presentations (8:30am - 11:30am)
Written final project report due at 10pm

What you will learn

You will learn how to use R to …

  • read, wrangle, and analyze data
  • make publication-ready plots

Understand the philosophy behind null hypothesis significance testing (NHST) and Bayesian statistics through …

  • running computer simulations and visualizing the results

Formulate research questions as statistical models and …

  • determine which models work for different situations
  • check that the model’s assumptions are met, how much it matters, and what to do if assumptions aren’t met

Communicate what you have learned about your data …

  • in short presentations in class, showcasing your visualization and analysis
  • in written reports

Contribute to open and reproducible science through …

  • adopting good coding practices
  • sharing your data and research reports online

What to expect?

In “A Vision for Stanford”, university president Marc Tessier-Lavigne states that Stanford wants to be

“an inspired, inclusive and collaborative community of diverse scholars, students and staff, where all are supported and empowered to thrive.”

Let’s try our best together in this class to make this happen!

What you can expect from me

I will …

  • be in class 5 minutes before it starts to set up and stay for up to 10 minutes afterwards for questions.
  • start and end each class on time.
  • be there for you during office hours.
  • not be able to provide general stats consultation. The Statistics Department provides consultations.

What I expect from you

You will …

  • get ready for the course.
  • attend all of the classes and participate in class discussion.
  • attend the sections taught by the course TAs.
  • bring your laptops to class and section: we will code together and do live quizzes.
  • submit your assignments and final project on time.

Resources

Readings

For many classes, there will be readings and/or accompanying online interactive tutorials. We won’t adopt a course textbook.

Here is a list of useful resources:

Course notes:

The course notes are available as an online book here.

Free online books:

Text books:

Data sets

Here are some sources for finding interesting data sets:

Grading

  • Homework: 40% (the homework with the lowest score doesn’t count)
  • Midterm: 20%
  • Final project: 40%
    • Proposal: 5%
    • Presentation: 10%
    • Report: 25%
  • Extra credit
    • Piazza: 2%
    • Datacamp: 2%

Policies

Please familiarize yourself with Stanford’s honor code. We will adhere to it and follow through on its penalty guidelines.

When is the weekly homework due?

Each week, we will make the homework available on Wednesday after class. The homework is then due on Tuesday 8pm the week after.

Can we work in groups?

Work for the course will include both homework assignments and a final project.

  • Homework assignments: You are encouraged to work in groups. However, your writeup must be your own. You will mark who you worked with on your writeup.
  • Final project: You can either work on your own, or in a group of no more than three members. The project expectations scale with the size of the group (i.e. more is expected from a 3-person group compared to an individual project). A group will jointly write the project proposal, give the class presentation, and prepare the final report. Every member of a group will receive the same grade.

What if I can’t make a section?

We offer two sections per week. If you can’t make the section that you’ve been assigned to, then please go to the other section. If you can’t make either section, make sure to get the section materials and go through them on your own.

Support

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 dated in the current quarter in which the request is being made. 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: http://oae.stanford.edu).

Stanford is committed to ensuring that all courses are financially accessible to its students. If you require assistance with the cost of course textbooks, supplies, materials and/or fees, you should contact the Diversity & First-Gen Office (D-Gen) at opportunityfund@stanford.edu to learn about the FLIbrary and other resources they have available for support.

Stanford offers several tutoring and coaching services:

Feedback

We welcome feedback regarding the course at any point. Please feel free to email us directly, or leave anonymous feedback for the teaching team by using our online form.