Quantitative Social Science: data and code (qss)
Follow the analysis.
Select a node to explore the method
Install and load qss
Data preparation — shapes the raw inputs into what the estimator expects.
Install the teaching package from GitHub and load the resume audit-experiment dataset from the Causality chapter.
# Install: remotes::install_github("kosukeimai/qss-package")
# devtools::install_github("kosukeimai/qss-package", build_vignettes = TRUE)
library(qss)
data(resume, package = "qss")
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Cross-tabulate callbacks by race
A pre-flight check — run this before trusting any estimate downstream.
Tabulate callback (0/1) against the randomly assigned applicant race implied by the name.
race.call.tab <- table(race = resume$race, call = resume$call)
race.call.tab
prop.table(race.call.tab, margin = 1)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Difference-in-means in callback rates
The core estimate — where the causal quantity itself is computed.
Compute the callback rate for white-sounding and black-sounding names and take the difference (the average causal effect of race).
callback.rate <- prop.table(race.call.tab, margin = 1)[, 2]
ate <- callback.rate["white"] - callback.rate["black"]
ate
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Interpret the effect
Reporting — turn the numbers into a figure or table a reader can act on.
White-sounding names receive callbacks at a notably higher rate, evidence of racial discrimination in hiring.
round(callback.rate, 3)
round(ate, 3)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Inputs & data
No user data required—the package supplies the textbook's bundled datasets and chapter vignettes.
Show data format & exampleHide example
| dataset | description | rows |
|---|---|---|
| elections | U.S. election returns | 1000+ |
| afghan | Afghanistan survey | 2754 |
| resume | resume audit experiment | 4870 |
| social | social-pressure experiment | 305866 |
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
The estimate
\tau=\mathbb E\big[Y(1)-Y(0)\big]
⚠️ Unofficial community showcase of qss (docs). Not affiliated with the authors — all credit to Kosuke Imai & coauthors; this summarizes public documentation.
What it does: qss is the official companion R package to Kosuke Imai's textbook Quantitative Social Science: An Introduction (Princeton University Press, 2017). It packages all of the book's datasets and reproducible code so students and instructors can follow along chapter by chapter. How it works: the package ships ready-to-load datasets (elections, civil war, social-media, intervention studies, and more) and a set of vignettes—one per chapter (causality, measurement, prediction, probability, uncertainty)—that walk through the analyses using base R. Rather than introducing new estimators, it provides a curated, classroom-tested foundation for learning causal inference, measurement, prediction, and statistical inference through real social-science data. Assumptions: none statistical—it is a pedagogical resource. Installed from GitHub (not CRAN), typically with build_vignettes = TRUE to access the chapter tutorials. It anchors a wider teaching ecosystem, including tidyverse and learnr adaptations of the same material.
What you get — Loadable datasets and per-chapter vignettes reproducing the book's analyses (causality, measurement, prediction, probability, uncertainty).
Example output
call
race 0 1
black 2278 157
white 2200 235
prop.table(race.call.tab, margin = 1)[, 2]
black white
0.06447639 0.09650924
callback.rate["white"] - callback.rate["black"]
white
0.03203285
Discuss the workflow (0)
Log in to join the discussion.