Skip to main content

Linear Regression Assumption Interpretation Guide

Project description

Overview

This Library provides a comprehensive framework for testing the fundamental assumptions of linear regression models. It implements automated diagnostic tools to check whether your regression model meets the statistical requirements necessary for valid inference and prediction. Python 3.7+ License: MIT

📌 Purpose

Linear regression relies on several statistical assumptions (linearity, normality, homoscedasticity, independence, etc.). Many students and early researchers struggle with:

  • Knowing which tests to apply
  • Guide for interpreting statistical results
  • Presenting clear diagnostics and plots

AssumpHelper addresses these challenges by offering a structured, reusable workflow that checks regression assumptions and explains the results in a clear and organized way.


✨ Features

  • Automated linear regression assumption testing
  • Built‑in statistical tests with interpretation guides
  • Visualization support for diagnostics
  • Beginner‑friendly design with clear outputs
  • Modular structure for easy extension
  • Suitable for academic, research, and learning purposes

Supported Assumption Checks

  • Linearity (e.g., Ramsey RESET Test)
  • Homoscedasticity (Breusch–Pagan Test)
  • Normality of Residuals (Shapiro–Wilk Test)
  • Independence of Errors (Durbin–Watson Test)

📂 Project Structure

AssumpHelper/
│
├── assumphelper/
│   ├── __init__.py
│   ├── check.py
│   ├── exceptions.py
│   ├── hypothesis.py
│   ├── utilities.py
│   │
│   ├── linearity.py
│   ├── normality.py
│   ├── homoscedasticity.py
│   ├── independence.py
│   │
│   ├── linplot_interpretation_guide.txt
│   ├── normplot_interpretation_guide.txt
│   ├── homplot_interpretation_guide.txt
│   └── indepplot_interpretation_guide.txt
│
├── DOCS/
│   ├── examples/
│   │   └── examples.ipynb
│   │
│   └── tests/
│       └── test_assumphelper_assert_errors.ipynb
│
├── README.md
├── requirements.txt
├── setup.py
└── .gitignore

⚙️ Installation

Install the required packages using pip:

pip install assumphelper

🚀 Sample Usage

import numpy as np
from sklearn.linear_model import LinearRegression
import assumphelper as ah

np.random.seed(42)

# Generate clean linear data
n = 100
X = np.linspace(1, 50, n).reshape(-1, 1)
y = 2.5 * X.ravel() + 15 + np.random.normal(0, 2, n)

#Checking Linearity
model = LinearRegression()

linearity = ah.Linearity(model, X, y)
linearity.fit()
linearity.test()

RESET Test for Linearity F-statistic: 5.2888 p-value: 0.0710

Interpretation:

If alpha = 0.05 and p-value > 0.05: Assumption of Linearity is NOT VIOLATED.

linearity.plot()
image Interpretation Guide:

Linearity Plot (Residuals vs Fitted Values)

If the plot shows a random scatter of points around the horizontal axis with no clear curve, the relationship between the predictors and the outcome is linear.

The assumption of linearity is NOT VIOLATED.

If the plot shows a curve or systematic pattern in the scatter of points, the relationship between the predictors and the outcome is not linear.

The assumption of linearity is VIOLATED.

Always double check with the RESET test. (<Figure size 800x600 with 1 Axes>, <Axes: title={'center': 'Residuals vs Fitted Plot'}, xlabel='Fitted Values', ylabel='Residuals'>)

📊 Outputs

AssumpHelper provides:

  • Test statistics and their p‑values
  • Plain‑language interpretation (Pass / Violation)
  • Diagnostic plots (residuals vs fitted, Q‑Q plots, etc.)
  • Structured interpretation guides for reports and presentations

🎓 Intended Users

  • Students learning linear regression
  • Beginners who want clarity without losing rigor

🧠 Inspiration

This project is inspired by common regression workflows in:

  • Statistics & Econometrics courses
  • Python libraries such as statsmodels and scikit‑learn
  • The need for simpler interpretation of assumption tests

🔧 Requirements

  • Python 3.7+
  • numpy
  • pandas
  • scipy
  • statsmodels
  • matplotlib
  • seaborn

(See requirements.txt for the full list.)


📜 License

This project is released under the MIT License.


👤 Author

Developers

[Kirsten Roise G. Moog]

Our distinguish Leader & Inceptionist & Structural Design

[Rodel P. Badilla]

Our Assistant Leader

Leaders Roles

  • Designed clean separation of concerns
  • Implementing codes engine
  • Created visualization tools
  • Enhanced plotting capabilities

[Hannah Dennisse Y. Aque]

[James Walte C. Prollo]

[Zell Caamino]

Roles

Back (support)

  • Built comprehensive test suite
  • Wrote user documentation.
  • Quality assurance

Note: This diagnostic framework helps ensure the validity of your regression analysis by systematically checking fundamental statistical assumptions. Regular use of these tools will improve the reliability and interpretability of your regression models.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

assumphelper-0.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

assumphelper-0.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file assumphelper-0.2.0.tar.gz.

File metadata

  • Download URL: assumphelper-0.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for assumphelper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8f5585b269b31acb891d737fd49a398f321ffc9fbc09f1b2ddf48f24c5d75953
MD5 bd29d1f3bb4b224093163e37e37b8e7e
BLAKE2b-256 02c228ad81229925b5f77ce54b0cc30a795f2a2847dcab6e713803b053ce4829

See more details on using hashes here.

File details

Details for the file assumphelper-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: assumphelper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for assumphelper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de4a31fc10f42091dd6ff84cb71303e2128bb0f34e78ce8c1fb926dd666f7203
MD5 cf8d5e0e2906b1f4bc607e85066ebdb7
BLAKE2b-256 cdff230688c421bb3360efaed99e8b2b76aba9450e9d7a229980fdf11adfd0f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page