Skip to content

Commit

Permalink
version bump prep
Browse files Browse the repository at this point in the history
- changes made by Jules reviewed
- added pingouin dependency
  • Loading branch information
teanijarv committed Apr 6, 2023
1 parent 9e9c420 commit dce4961
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
10 changes: 9 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ History
* Fixed pairwise correlations threshold for multicollinearity assumption testing (0.3 -> 0.7)
* Fixed partial regression plots fixed figure size
* Added titles to diagnostic plots
* Fixed the VIF to match with SPSS output by adding the constant to X
* Fixed the VIF to match with SPSS output by adding the constant to X

0.1.5 (2023-04-6)
------------------

* Added standardised beta coefficients to model output
* Added partial and semi-partial correlations (unique variance) to model output
* Fixed F-change degrees of freedom calculation
* Fixed F-change p-value calculation
7 changes: 6 additions & 1 deletion HLR/hierarchical_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def linear_reg(X, X_names, y):
beta_conversion = [b * c for b,c in zip(coeffs_values, conversion)]
std_coeffs = dict(zip(coeffs_keys, beta_conversion)) # 25/03/23 dictionary to store beta_coefficients

# 05/04/2023 - Calculate the partial and semi-partial (part in SPSS) correlations for each X value with y, while holding other X values as covariates
# 05/04/2023 - Calculate the partial and semi-partial (defined 'part' in SPSS) correlations
# for each X value with y, while holding other X values as covariates
# Initialize an array to store partial and semi-partial correlation values
x_cols = [X.columns.tolist()]
semi_partial_correlations = np.zeros(len(x_cols[0]))
Expand Down Expand Up @@ -225,6 +226,10 @@ def hierarchical_regression(X, X_names, y, diagnostics=True, save_folder='result
MSE (total) = total mean square error
Beta coefs = coefficient values for intercept and predictors
P-values (beta coefs) = p-values for intercept and predictors
Std Beta coefs = standardised beta coefficients for intercept and predictors
Partial correlation = partial correlation for each X value with y
Semi-partial correlation = semi-partial correlation for each X value with y
Unique Variance % = squared semi-partial correlation for unique variance of predictors
R-squared change = r-squared change for model (Step 2 r-sq - Step 1 r-sq)
F-value change = f change for model (Step 2 f - Step 1 f)
P-value (F change) = p-value of f-change of model
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HLR - Hierarchical Linear Regression in Python

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7683809.svg)](https://doi.org/10.5281/zenodo.7683809) [![image](https://img.shields.io/pypi/v/HLR.svg)](https://pypi.python.org/pypi/HLR) [![image](https://img.shields.io/travis/teanijarv/HLR.svg)](https://travis-ci.com/teanijarv/HLR) [![Documentation Status](https://readthedocs.org/projects/hlr-hierarchical-linear-regression/badge/?version=latest)](https://hlr-hierarchical-linear-regression.readthedocs.io/en/latest/?version=latest)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7683809.svg)](https://doi.org/10.5281/zenodo.7683809) [![image](https://img.shields.io/pypi/v/HLR.svg)](https://pypi.python.org/pypi/HLR) [![Build Status](https://app.travis-ci.com/teanijarv/HLR.svg?branch=main)](https://app.travis-ci.com/teanijarv/HLR) [![Documentation Status](https://readthedocs.org/projects/hlr-hierarchical-linear-regression/badge/?version=latest)](https://hlr-hierarchical-linear-regression.readthedocs.io/en/latest/?version=latest)

HLR is a simple Python package for running hierarchical regression. It was created because there wasn't any good options to run hierarchical regression without using programs like SPSS.

Expand Down Expand Up @@ -41,6 +41,7 @@ HLR is meant to be used with Python 3.x and has been tested on Python 3.7-3.9.
- [SciPy](https://www.scipy.org/)
- [Pandas](https://pandas.pydata.org/)
- [statsmodels](https://www.statsmodels.org/)
- [pingouin](https://pingouin-stats.org/)
- [matplotlib](https://matplotlib.org/)
- [seaborn](https://seaborn.pydata.org/)

Expand Down Expand Up @@ -158,6 +159,7 @@ Would be great if someone with more experience with packages would contribute wi
#### Contributors
[Toomas Erik Anijärv](https://github.com/teanijarv)
[Rory Boyle](https://github.com/rorytboyle)
[Jules Mitchell](https://github.com/JulesMitchell)

#### Credits
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ scipy==1.7.3
pandas==1.3.5
matplotlib==3.5.2
seaborn==0.11.2
statsmodels==0.13.2
statsmodels==0.13.2
pingouin==0.5.3
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
'pandas>=1.3.5',
'matplotlib>=3.5.2',
'seaborn>=0.11',
'statsmodels>=0.13']
'statsmodels>=0.13',
'pingouin>=0.5.3']

test_requirements = ['pytest>=3']

Expand Down Expand Up @@ -50,6 +51,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/teanijarv/HLR',
version='0.1.4',
version='0.1.5',
zip_safe=False,
)

0 comments on commit dce4961

Please sign in to comment.