Welcome! This repository contains comprehensive materials for learning regression analysis using real-world public data.
A comprehensive tutorial covering:
- Simple Linear Regression - Foundation concepts
- Multiple Linear Regression - Multiple predictors
- Polynomial Regression - Non-linear relationships
- Ridge Regression - L2 regularization
- Lasso Regression - L1 regularization with feature selection
- ElasticNet - Combined L1/L2 regularization
- Model Comparison - Choosing the best approach
- Residual Analysis - Validating model assumptions
This tutorial uses real datasets from FiveThirtyEight, the data journalism organization founded by Nate Silver.
- Repository: github.com/fivethirtyeight/data
- License: Creative Commons Attribution 4.0
- Primary Dataset Used: College Majors & Economic Outcomes
The repository contains 100+ datasets covering:
- Sports: NBA, NFL, MLB ELO ratings and player statistics
- Politics: Election forecasts, polling data, congressional demographics
- Economics: Employment data, college outcomes, alcohol consumption
- Culture: Bob Ross paintings, Bechdel test analysis
Nate Silver is a statistician and writer famous for:
- Founder of FiveThirtyEight (originally under The New York Times, then ESPN, now independent)
- Author of "The Signal and the Noise" - bestselling book on prediction
- Pioneer in election forecasting using statistical models
- Currently publishes the Silver Bulletin newsletter
Silver is known for:
- Bayesian reasoning - updating beliefs with new evidence
- Model averaging - combining multiple models for robustness
- Uncertainty quantification - always showing confidence intervals
- Historical data - using past patterns to inform predictions
- Feature engineering - careful selection of meaningful predictors
- Silver Bulletin (natesilver.net) - Independent newsletter with polling analysis
- 2024 Election forecasting model
- Pollster ratings and methodology updates
- Article: "Fine, I'll run a regression analysis. But it won't make you happy."
- Book: "The Signal and the Noise"
- Original site: FiveThirtyEight Regression Model Q&A
pip install numpy pandas matplotlib seaborn scikit-learn jupyter scipyjupyter notebook regression_analysis_tutorial.ipynbUsing FiveThirtyEight data, you could analyze:
-
Sports Performance
- NBA player statistics → team success
- MLB ELO ratings → win prediction
-
Political Trends
- Polling data → election outcomes
- Demographics → voting patterns
-
Economic Outcomes
- College major → median earnings (included in tutorial)
- Education level → unemployment rates
After completing this tutorial, you'll understand:
- ✅ How regression models work mathematically
- ✅ When to use different types of regression
- ✅ How to prevent overfitting with regularization
- ✅ How to evaluate and compare models
- ✅ How to interpret model coefficients
- ✅ How professional analysts like Nate Silver approach problems
# Browse available datasets
import pandas as pd
# See all available datasets
url = "https://github.com/fivethirtyeight/data"
# Or use the R package: install.packages("fivethirtyeight")- Newsletter: Silver Bulletin
- Twitter/X: @NateSilver538
- Book: "The Signal and the Noise: Why So Many Predictions Fail—But Some Don't"
Feel free to:
- Add more datasets from FiveThirtyEight
- Implement additional regression techniques
- Create visualizations
- Improve explanations
- Tutorial code: Open for educational use
- FiveThirtyEight data: Creative Commons Attribution 4.0 International License
- Always cite the original data source when using FiveThirtyEight datasets
- Nate Silver and the FiveThirtyEight team for making data publicly available
- The open-source community for excellent Python libraries
- Contributors to the FiveThirtyEight data repository
Happy Learning! 📈
Remember: "Distinguishing the signal from the noise requires both scientific knowledge and self-knowledge." - Nate Silver