Python library to create regression graphs
Project description
README.md:
# Regression Graph
## Overview
This Python library was designed to create regression graphs for datasets. Instead of using p-values, this library will use the coefficients and confidence interval to plot bars for each variable in the given dataset. The bars will be plotted with their upper and lower confidence interval and will use the p-value for the saturation of the bars. There's optional arguments to standardize the dataset. A table can be created to display the variable, mean and standard deviation of the dataset.
## Features
plot_graph: plot the regression graph with manual data or with statsmodel regression
create_table: create a table for the variables, mean and standard deviation
extract_data: use the statsmodel library to pass a fitted regression model which will extact the coefficents, confidence interval and p-value from the model and pass it onto plot_graph to produce the graph.
regression_plot, call this function and either inpur manaul dataset or statsmodels regression model to produce the graph. This function will either call extract_model if a regression is passed or plot_graph if manual data is passed. Call create_table to produce a table with the variable name, mean and standard devisation of the values.
## Installation
Install the package using pip install regression graph
## Example usage
```python
from regression_graph import regression_plot
Statsmodel
- Read file path file
- Remove rows with missing values
- select the dependent variable (y) and independent variables (X)
- Fit the regression model
- Give variable names for the y-axis eg x
- Plot the regression coefficients with confidence intervals Call regression_plot(ax1, model_result=model, variable_names=variable_names, positive_bar_colour=none, negative_bar_colour=none, title)
- Optional table create_table(ax2=position, dataframe, loc=none, font_size=none, col_widths=none, label_cell_loc=none, label_bbox=mandatory)
Manual input
- Provide the coefficients, confidence intervals upper and lower bounds, and p-values
- Call regression_plot regression_plot(ax1, model_result=model, variable_names=X_cols)
- Optional table create_table(ax2=position, dataframe, loc=none, font_size=none, col_widths=none, label_cell_loc=none, label_bbox=mandatory)
Both options allow the values to be standardize by doing standardize=True in the regression_plot argument. If standardize=True then user is required to give an input_X value (this is the indepdenat variable, can be a column from the dataset) for the function to work.
Requirements
Python 3.6 and above Numpy Matplotlib Pandas Statsmodels (optional)
License
This project is licensed under MIT, view license here - https://choosealicense.com/licenses/mit/
Contact
Please feel free to leave any feedback or questions here: saemakhanom@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file regression_graph-0.1.tar.gz.
File metadata
- Download URL: regression_graph-0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3668f97a8d35cfcea1a4dd2923a2cc6704e57d217465c7dd13b66986f47a0dc8
|
|
| MD5 |
be215cc353878012f52ca1c838069fa8
|
|
| BLAKE2b-256 |
6c5dc5bb08c2128209e118887650befab4dd738e817efda71087deabf7aff5b2
|
File details
Details for the file regression_graph-0.1-py3-none-any.whl.
File metadata
- Download URL: regression_graph-0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8019a7c31d11dab0fbb7acbfcab9c15aeae7e4149b8e9db963cde90fc5aace4
|
|
| MD5 |
ecb837c4ebbf659a7f78bacf2e4d7aad
|
|
| BLAKE2b-256 |
2a30ae7f929604c6d8750f68740d6156bfdd7d1b9584a2687d51328c4e52c83d
|