Explorations on statistical themes -- a collection of Jupyter notebooks investigating topics in probability, stochastic processes, and causal inference.
1. Balls in a Box -- Random Walk Simulation
A Monte Carlo simulation of particles performing random walks in a bounded 2D box with elastic wall reflections. Explores diffusion, the Central Limit Theorem, and equilibrium distributions for reflected random walks.
Key concepts: Random walks, Brownian motion, diffusion, elastic boundary reflection, ergodic equilibrium, Monte Carlo simulation
Notebooks:
- balls moving in a box.ipynb -- Main simulation
- Colormap reference.ipynb -- Matplotlib colormap reference
2. Causal Inference -- Potential Outcomes and Experimental Analysis
Explorations in causal inference using the Rubin causal model (potential outcomes framework), based on the Mixtape Sessions by Scott Cunningham. Includes simulation of selection bias under different treatment assignment mechanisms and replication of the Thornton (2008) HIV testing experiment.
Key concepts: Average Treatment Effect (ATE), selection bias, Simple Difference in Outcomes (SDO), OLS regression, randomized controlled trials, potential outcomes framework
Notebooks:
- lab1.ipynb -- Potential outcomes framework simulation (perfect doctor vs. random assignment)
- thornton lab.ipynb -- Thornton (2008) HIV testing experiment replication
- Python 3
- NumPy, Matplotlib, Pandas, statsmodels
- imageio (for GIF generation in the random walk simulation)
The balls_in_a_box module is licensed under the GNU General Public License v3.0.

