PRegress
PRegress is a Python package for regression analysis and data visualization. It provides tools for model fitting, prediction, and various types of plots to help visualize your data particularly for regression analysis.
Features
- Model fitting and prediction with convenient formula notation
- Streamlined code for plotting (boxplot, histogram, scatter plot, etc.)
- Regression analysis diagnostic tools
- Integration with popular libraries like
pandasandstatsmodels
Installation
You can install the package using pip:
pip install pregress
Usage
Here are some examples of how to use the key functions in the package.
Importing the Package
To use the functions provided by the package, import it as follows:
import pregress as pr
Getting Data
There are multiple datasets available from PRegress and are easily attained using the get_data function. The datasets currently available are:
- AirBnb.csv
- Betas.csv
- Charges.csv
- Employment.csv
- HousePrices.csv
- HR_retention.csv
- MarketingToys.csv
- Sales.csv
- Top200.csv
- Twitter.csv
- Youtube.csv
See Applied Linear Regression for Business Analytics with Python for details regarding these datasets. Sample import example:
import pregress as pr
# Load data from PRegress
df = pr.get_data("Betas.csv")
# Format the data (for later)
df.drop(columns = df.columns[0], inplace=True)
Model Fitting and Prediction
PRegress formula supports formula functionality similar to R. Fit a model with a formula:
# Fit model with formula
model = pr.fit("SPY ~ .", df)
Summary types are specified using the out argument. Different summaries are available including:
- statsmodels (default)
- R
- STATA
- simple
- ANOVA
- coefficients (coef)
# Generate a model summary
pr.summary(model)
Making Predictions
A Statsmodels object is created by default. From this object, the predict function can be used. Since df is the dataframe used to fit the model, the following lines produce the same result.
# Make predictions
pr.predict(model, df)
# Produce fitted values
pr.predict(model)
General Plotting
Plotting code is streamlined and built on top of Seaborn and MatPlotLib. Samples provided below.
# Generate a boxplot
pr.boxplot("SPY ~ .", df)
# Generate a histogram
pr.hist(df.SPY)
# Multiple histograms
pr.hists("SPY ~ .",data = df)
# Scatter plot
pr.plotXY("MSFT ~ SPY", data = df)
# Multiple Scatter plots
pr.plots("SPY ~ .", data = df)
# Correlation Plot
pr.plot_cor(df)
Required Fixes
Based on current testing, the following fixes are required:
- Ensure global scope accessibility for variables.
- Adjust summary spacing.
- Provide compatibility with
scikit-learn. - Implement AI-generated summaries.
- Allow for additional plotting customization (using kwargs).
- Review and improve diagnostic plots.
- Provide support for logistic regression and other GLMs.
- Provide support for automatic dummy variable retrieval.
- Plots should work without formulas.
Contributing
We welcome contributions to PRegress! If you find a bug or have a feature request, please open an issue on GitHub. You can also contribute by:
- Forking the repository
- Creating a new branch (
git checkout -b feature-branch) - Committing your changes (
git commit -am 'Add some feature') - Pushing to the branch (
git push origin feature-branch) - Creating a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
We would like to thank all contributors and users of PRegress for their support and feedback. Special thanks to Mintra Putlek!
Metadata
Release files for pregress 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pregress-1.0.9.tar.gz | 256.1 kB | Without provenance | Details for pregress-1.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pregress-1.0.9-py3-none-any.whl | Python 3 | none | any | Details for pregress-1.0.9-py3-none-any.whl |
Total release size: 531.9 kB
Release files / pregress-1.0.9.tar.gz
| Download URL | pregress-1.0.9.tar.gz |
|---|---|
| Size | 256.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3596169043c72bfcf387e887d291d415d9ddcbd40a0b21011adcf7a2caa3570
|
|
BLAKE2b-256 checksum How to use checksums |
c786adbda85aad5849d87708a28daa8ae474e7192a9c323f325842d82d46449e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.9
|
Release files / pregress-1.0.9-py3-none-any.whl
| Download URL | pregress-1.0.9-py3-none-any.whl |
|---|---|
| Size | 275.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0866d92290079d89b7df31b2bf1ed695398a38e2aa526053ea0c67914de7f95
|
|
BLAKE2b-256 checksum How to use checksums |
6623c1836c594261b9cce3f18a5b678d0b8ee1715aaf5c775ef150ab575a2f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.9
|
Security for pregress 1.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.