Metadata-Version: 2.1
Name: snha4py
Version: 0.0.1
Summary: St. Nicholas House algorithm for Python
Home-page: https://github.com/thake93/snha4py
Author: Tim Hake
Author-email: timhake@icloud.com
License: MIT License
Project-URL: Documentation, https://htmlpreview.github.io/?https://github.com/thake93/snha4py/blob/main/docs/__init__.html
Description-Content-Type: text/markdown
License-File: LICENSE

# snha4py
Snha4py is a python implementation of the St. Nicholas House algorithm (_Groth et al. 2019, Hermanussen et al. 2021, Hake et al. 2023_). 
The algorithm infers a graph based on the correlation coefficient between variables of a data set. Here, the nodes and the edges would be the variables of the data set and the correlation coefficient, respectively. 
The correlation coefficient is evaluated in terms of association chains. 
Therfore, the absolute coefficient is ranked and compared pairwise.
An association chain is characterized by a sequence of variables for which reversing the start and end point does not change the order of elements.
These chains then build the graph.

Next, to the algorithm the package offers a variety of graph implementations, as well as a vizualization routine for the graphs and the correlation matrix.

Also, a module to create correlated data along a directed graph based on a Monte Carlo approach is included (_Novine et al. 2022_).

# Documentation

- [HTML](https://htmlpreview.github.io/?https://github.com/thake93/snha4py/blob/main/docs/__init__.html)
- [Markdown](https://github.com/thake93/snha4py/blob/main/docs/Snha.md)

# Install
```
$ pip3 install snha4py (soon)
```
```
$ pip3 install git+https://github.com/thake93/snha4py.git --user
```

# Create your 1<sup>st</sup> "St. Nicolas House"
```shell
$ python3
```
```python
Python 3.x.xx ()

>>> from Snha import Snha
>>> import matplotlib.pyplot as plt

>>> s = Snha()
>>> s.new_graph()
>>> s.create_corr_data(200,25)
>>> s.comp_corr(method='spearman')
>>> s.st_nich_alg()

>>> fig,ax = plt.subplots(1,3, figsize=(30,10))

>>> s.plot_graph(pred=False, ax=ax[0])
>>> s.plot_corr(ax=ax[1])
>>> s.plot_graph(ax=ax[2])

>>> ax[0].set_title('True Graph')
>>> ax[1].set_title('Correlation Coefficient')
>>> ax[2].set_title('Predicted Graph')

>>> plt.show()
```
<div align="center">
  <img src="https://github.com/thake93/snha4py/blob/main/examples/example.png">
</div>

# References
Groth, D., Scheffler, C., and Hermanussen, M. (2019). Body height in stunted indonesian children
depends directly on parental education and not via a nutrition mediated pathway - evidence
from tracing association chains by st. nicolas house analysis. *Anthropologischer Anzeiger*,
76(5):445–451. [DOI](https://doi.org/10.1127/anthranz/2019/1027)

Hake, T., Bodenberger, B., Groth, D. (2023). In Python available: St. Nicolas House Algorithm (SNHA)
with bootstrap support for improved performance in dense networks. *Human Biology and Public Health* 4.

Hermanussen, M., Aßmann, C., and Groth, D. (2021). Chain reversion for detecting associations
in interacting variables—st. nicolas house analysis. *International Journal of Environmental
Research and Public Health*, 18(4). [DOI](https://doi.org/10.3390%2Fijerph18041741)

Novine, M., Mattsson, C. C., & Groth, D. (2022). Network reconstruction based on synthetic data generated by a Monte Carlo approach. *Human Biology and Public Health, 3*. 
[DOI](https://doi.org/10.52905/hbph2021.3.26)

# License
[MIT License](https://github.com/thake93/snha4py/blob/main/LICENSE)
