Skip to main content

Treat multicollinearity and non-significant variables from your statsmodels linear and logistic regressions

Project description

Regression and Statistical Inference Toolkit

Welcome to the reg_stat_inference toolkit!

This toolkit provides functions for treating multicollinearity and performing feature selection based on p-values in linear regression and logistic regression models. It leverages the statsmodels library for model analysis.

Purpose

The purpose of this toolkit is to offer a collection of Python functions that streamline the process of dealing with multicollinearity and feature selection in regression models. It aims to simplify the analysis of complex datasets by automating tasks like variance inflation factor (VIF) calculation and p-value-based feature removal.

reg_stat_inference

reg_stat_inference is a Python package that provides functions for treating multicollinearity and performing statistical inference in regression models. It offers tools to identify and address multicollinearity issues and to iteratively drop features based on p-values. This can help you build more interpretable and robust regression models.

Installation

You can install reg_stat_inference using pip:

pip install reg-stat-inference

Usage

To use the toolkit, import the functions in your scripts or notebooks:

import pandas as pd
import statsmodels.api as sm
from reg_stat_inference import treat_regression_model

# Create sample data
X = pd.DataFrame({'feature1': [1, 2, 3], 'feature2': [4, 5, 6]})
y = pd.DataFrame({'target': [0, 1, 0]})

# Use the treat_regression_model function with OLS regression
result = treat_regression_model(X, y, threshhold_vif=5, threshold_pval=0.05, reg_type='OLS')

# Print the treated feature list and the model summary
print("Treated Features:", result.metric_list)
print(result.model.summary())

You can then apply these functions to your dataset to enhance the quality of your regression models.

Git Repo

For detailed documentation and usage examples, please refer to the GitHub repository.

Contributing

Contributions are welcome! If you have suggestions, bug reports, or improvements, please open an issue or submit a pull request.

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

reg_stat_inference-0.1.7.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

reg_stat_inference-0.1.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file reg_stat_inference-0.1.7.tar.gz.

File metadata

  • Download URL: reg_stat_inference-0.1.7.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1028-aws

File hashes

Hashes for reg_stat_inference-0.1.7.tar.gz
Algorithm Hash digest
SHA256 a6629df8219dfe47212cb6d2cbf441f970ac44cd87a9d17290a7373e83f373f1
MD5 6b4386cf2a227d9f11d0dbaf4068faf5
BLAKE2b-256 c7ee8c66a85a1461d3c2ac6001fde328ed24636990d192dacbe3c2f582efe7c1

See more details on using hashes here.

File details

Details for the file reg_stat_inference-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: reg_stat_inference-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1028-aws

File hashes

Hashes for reg_stat_inference-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7af63e559831767a4e50e78fa805461a5fa19b0bd87067563c9d243c34e1e46f
MD5 f49d37351224ddf32938202a90da014a
BLAKE2b-256 7eb0376f647f432ebea95bbc68c611ad67a6480391ce1ae1fe5a05b5cc874ff6

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