Regression.Studio

Interactive visualizations, R programming resources, and references designed to accompany the methods covered in HPM 543. Materials are organized by type and can be used independently or alongside course sessions.

R Resources


R & RStudio Quickstart Guide
Installation, packages, libraries, file types, and getting started with R
Quick Reference
Quick-reference tables for base R, dplyr, ggplot2, tidyverse, and external PDF cheat sheets
Regression in R: A Reference
Common regression commands, model specification, and output interpretation
Mixtape Syntax Translations
Translations of applied examples from Cunningham's The Mixtape from Tidyverse to Base R and data.table syntax

Visualizations: OLS Mechanics


Interactive
OLS: Single Variable
Minimizing the sum of squared errors with one predictor
Interactive
OLS: Multiple Variables
Extending OLS to multiple predictors
Interactive
SSE vs SAE
Comparing sum of squared errors and sum of absolute errors
Interactive
Least Squares Animated
Step-by-step animation of the OLS minimization process
β̂₀ β̂₁x₁ β̂₂x₂
Interactive
Linear Model Decomposition
Decompose fitted values into predictor components; builds intuition for partial regression and Frisch-Waugh-Lovell

Visualizations: Multivariable Regression


Interactive
3D Regression Plane
Visualizing the regression surface with two predictors
Interactive
Interaction Surface
How interaction terms twist the regression surface
Interactive
Collinearity Bands
How multicollinearity affects coefficient estimation and confidence bands
marginal vs. partial
Interactive
Controlling for a Variable
How correlated predictors change partial vs. marginal slopes

Visualizations: Binary Variables


Group 0 Group 1
Interactive
Simple Group Indicator
How a 0/1 predictor shifts the regression line to compare two groups
Interactive
Indicator Variables and Interactions
How categorical variables enter the regression model
Sigmoid NLL Surface
Interactive
Logistic Regression: Full MLE
Negative log-likelihood surface and maximum likelihood estimation
Group 0 Group 1
Interactive
Controlling for a Binary Variable
How a binary covariate shifts the regression line and changes slope estimates

Visualizations: Causal Inference


cutoff
Interactive
Regression Discontinuity
Bandwidth selection, polynomial fit, and local ATE estimation at the cutoff
intervention
Interactive
Interrupted Time Series
Pre/post treatment effect estimation with trend adjustment
Treated Control
Interactive
Matching Strategies
Comparing propensity score, caliper, and coarsened exact matching
ATE ATT Treated Control
Interactive
ATE vs ATT
Average treatment effect vs treatment effect on the treated; selection bias and overlap
C X Y
Game
Confounding Game
Identify backdoor paths and valid adjustment sets in directed acyclic graphs
Treatment Control ATE
Interactive
Randomization vs. Selection Bias
How random assignment eliminates selection bias and recovers the true average treatment effect
DiD Pre Post
Interactive
Difference-in-Differences
Classic 2x2 DiD with interactive parameters, counterfactual projection, and coefficient estimation

R Syntax Translations


Chapter-by-chapter R translations for the statistical methods and examples in both course texts. Each guide maps concepts to working R code, with tabs for multiple dialects where available.

Impact Evaluation in Practice (Gertler et al.)

Chapter 3
Causal Inference and Counterfactuals
Chapter 4
Randomized Control Trials
Chapter 5
Instrumental Variables
Chapter 6
Regression Discontinuity
Chapter 7
Difference-in-Differences
Chapter 8
Matching and Propensity Scores

Causal Inference: The Mixtape (Cunningham)

Chapter 2
Probability and Regression Review
Chapter 4
Potential Outcomes Causal Model
Chapter 9
Difference-in-Differences

MiniViz / Widgets


Counterfactual Effect Estimator OLS Minimization Three Views of Causal Reality ATE, ATT, and Selection Bias SSE Two-Panel Comparison Rubin Potential Outcomes: Snakes-In-A-Log Difference-in-Differences (Mini)

Studio


Coming Soon
An interactive workspace for building and testing regression models