This project explores how interaction and polynomial terms affect linear regression modeling using a simulated dataset. The study highlights how including higher-order terms influences predictor coefficients and overall model fit. The dataset is generated within the notebook, so no external data is required.
ols_interaction_analysis.ipynb
— Main Jupyter Notebook with code, explanations, and results.ols_interaction_analysis.html
— Exported HTML version of the notebook.ols_interaction_analysis.pdf
— Exported PDF version of the notebook.figures/
— Contains exported plots mainly for reference; all figures are already embedded in the outputs.
- Simulated dataset with continuous predictors.
- Linear regression models with and without interaction and polynomial terms.
- Comparison of model coefficients and overall fit metrics.
- Visualization of regression surfaces and interaction effects.
- Python (3.10.16 recommended)
- Jupyter Notebook / Jupyter Lab
- Python packages:
pandas
,numpy
,matplotlib
,statsmodels
,ISLP
You can install the required packages with:
pip install pandas numpy matplotlib statsmodels ISLP
- Clone or download this repository.
- Open
ols_interaction_analysis.ipynb
in Jupyter Notebook or Jupyter Lab. - Run all cells to reproduce results, figures, and exported HTML/PDF outputs.