Skip to content

rodelcoder1/AssumpHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

209 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors