Skip to content

This project investigates the effect of including interaction and polynomial terms impacts model coefficients and overall fit. Features visualizations of simulated predictors, response variables, and regression surfaces. This project was done in Python.

License

Notifications You must be signed in to change notification settings

alan-c-lin/ols_interaction_analysis

Repository files navigation

Exploring Interaction Effects in Linear Regression: A Simulation Study

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.

Project Structure

  • 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.

Key Points

  • 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.

Requirements

  • 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

How to Use

  1. Clone or download this repository.
  2. Open ols_interaction_analysis.ipynb in Jupyter Notebook or Jupyter Lab.
  3. Run all cells to reproduce results, figures, and exported HTML/PDF outputs.

About

This project investigates the effect of including interaction and polynomial terms impacts model coefficients and overall fit. Features visualizations of simulated predictors, response variables, and regression surfaces. This project was done in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published