Skip to main content

R-style linear regression in Python with comprehensive statistics and visualizations

Project description

EasyLM

EasyLM is a Python library for linear regression with R-style summaries, automatic coefficient interpretation, and model comparison. It provides simple interfaces, comprehensive statistics, and built-in visualizations.

Python 3.7+ License: MIT


Features

  • R-like lm() interface with comprehensive summaries
  • Coefficients, standard errors, t-values, p-values, R², AIC, BIC
  • Compare multiple models side-by-side
  • Built-in plotting for model comparison
  • Accepts NumPy arrays, Pandas DataFrames, and Python lists
  • Clean, modular, and extensible architecture

Installation

Install directly from PyPI:

Installation

You can install from TestPyPI:

pip install amoang-easylm

Or install the latest version from GitHub:

git clone https://github.com/yourusername/EasyLM.git
cd EasyLM
pip install -r requirements.txt
pip install -e .

Basic Usage

from EasyLM import LinearModel
import numpy as np

# Create sample data
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2, 4, 5, 4, 5])

# Fit model
model = LinearModel()
model.fit(X, y)

# View R-style summary
print(model.summary())

Example Output

After fitting a simple model, you’ll see an R‑style summary:

Call: EasyLM LinearModel

Observations: 5
Parameters: 2
Degrees of Freedom (resid): 3

Coefficients:
   Coef.  Std.Err.  t value  Pr(>|t|)
0  1.5000    0.7906   1.8974    0.1535
1  0.7000    0.2280   3.0702    0.0547

Residual variance (sigma^2): 0.7000
R-squared: 0.7588
AIC: 10.7319
BIC: 9.9465 

Key Concepts

Linear regression fits the model:

y = β₀ + β₁x₁ + β₂x₂ + … + ε

  • y: target variable
  • x: features
  • β: coefficients
  • ε: residual error

Summary Output

  • Coef.: coefficient values
  • Std.Err.: standard error
  • t value: coefficient ÷ Std.Err.
  • Pr(>|t|): p-value (<0.05 considered significant)
  • : variance explained
  • AIC/BIC: model selection metrics
  • Residual variance: remaining error

Project Structure

EasyLM/
├── EasyLM/
│   ├── __init__.py
│   ├── linear_model.py
│   ├── data_preprocessor.py
│   ├── regression_stats.py
│   ├── summary_formatter.py
│   ├── model_comparator.py
│   ├── plot_helper.py
│   └── utils.py
├── tests/
│   ├── __init__.py
│   ├── test_linear_model.py
│   ├── test_model_comparator.py
│   └── test_utils.py
├── examples/
│   └── quickstart.ipynb
├── README.md
├── requirements.txt
├── pyproject.toml
└── LICENSE

Core Classes

Classes and Their Purpose

Class Purpose
LinearModel Fit and predict linear models
DataPreprocessor Validate and transform data
RegressionStats Compute statistical quantities
SummaryFormatter Generate R-style summaries
ModelComparator Compare multiple models
PlotHelper Visualization utilities

Testing

Run tests with pytest:

pip install pytest
pytest tests/ -v
pytest --cov=EasyLM tests/ 

Comparison with Alternatives

📊 Comparison with Alternatives

Feature EasyLM scikit-learn statsmodels
R-style summaries
Easy to learn
Statistical tests
Model comparison ⚠️
Lightweight
Extensible

When to Use

Use EasyLM if you want:

  • R‑style regression output in Python
  • Easy model comparison
  • Teaching/learning regression concepts
  • Clean, extensible code

Use alternatives when you need:

  • Production ML pipelines → scikit‑learn
  • Advanced econometrics → statsmodels
  • Deep learning → TensorFlow/PyTorch

Contributors

Core Team

[Kyle Paolo G Bautro] – Initial work & Architecture

  • Designed clean separation of concerns
  • Implemented RegressionStats engine
  • Created visualization tools

[Carl Dane Penano, Joshua Oraiz, Symond Ridge Fernandez] – Testing & Documentation

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

[Yochanan Bangoy] – Features & Extensions

  • Refactored plotting method
  • Enhanced plotting capabilities
  • Performance optimizations

Special Thanks

  • Inspired by R's lm() function
  • Documentation style influenced by scikit-learn
  • Jesus Christ

License

This project is licensed under the MIT License – see the LICENSE file for details.


Support


Roadmap

Version 1.0 (Current)

  • Basic OLS regression
  • R-style summaries
  • Model comparison
  • Visualization tools

Version 1.1 (Planned)

  • Weighted least squares
  • Ridge & Lasso regression
  • Cross-validation utilities
  • Polynomial features

Version 2.0 (Future)

  • Generalized Linear Models (GLM)
  • Time series regression
  • Mixed effects models
  • Interactive web dashboard

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

amoang_easylm-0.1.4.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

amoang_easylm-0.1.4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file amoang_easylm-0.1.4.tar.gz.

File metadata

  • Download URL: amoang_easylm-0.1.4.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for amoang_easylm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 de581660d708f2934c70a51bafefec5fb90dd6233ec8fb551d8da8a5da4961b7
MD5 665e3582a0b4540618d527f67b84ea05
BLAKE2b-256 04c7fc5c2eea87a79618aaf87c9b2bf59a3692e9cfa0c4ed2d4a36639f77c4a0

See more details on using hashes here.

File details

Details for the file amoang_easylm-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: amoang_easylm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for amoang_easylm-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1ba264fd836801a757d5c8b6690cf3a263467d93b2ffd4185b6047ad1c9d11cf
MD5 ef034473a965725e3610b536be965c32
BLAKE2b-256 54e119fbe95219149d7c130a45f7d533262f091172ea44f1b2359dce1b085998

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