Python library for simplifying statistical analysis and making it more consistent
Project description
Nightingale
I named this package Nightingale in honour of Florence Nightingale, The lady with the data.
Installation
You can use pip to install Nightingale:
pip install nightingale
Usage
Population Proportion
from nightingale import get_sample_size, PopulationProportion, get_z_score
print('z-score for 0.95 confidence:', get_z_score(confidence=0.95))
print('sample size:', get_sample_size(confidence=0.95, error_margin=0.05, population_size=1000))
print('with 10% group proportion:', get_sample_size(confidence=0.95, error_margin=0.05, population_size=1000, group_proportion=0.1))
population_proportion = PopulationProportion(sample_n=239, group_proportion=0.5)
print('error:', population_proportion.get_error(confidence=0.95))
Ordinary Least Squares (OLS)
import pandas as pd
import numpy as np
from nightingale import OrdinaryLeastSquares
data = pd.DataFrame({
'x': np.random.normal(size=20, scale=5),
'y': np.random.normal(size=20, scale=5),
})
data['z'] = data['x'].values + data['y'].values + np.random.normal(size=20, scale=1)
print('data:')
display(data.head())
ols = OrdinaryLeastSquares(data=data, formula='z ~ x + y')
print('ols results:')
display(ols.table)
print('r-squared:', ols.r_squared)
print('adjusted r-squared:', ols.adjusted_r_squared)
print('\n', 'summary:')
display(ols.summary)
ANOVA
References
z-score: https://stackoverflow.com/questions/20864847/probability-to-z-score-and-vice-versa-in-python
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
nightingale-2019.12.28.tar.gz
(23.4 kB
view hashes)
Built Distribution
Close
Hashes for nightingale-2019.12.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28f74128face5a6147a41c5d78c34448794ffc24e641805f713751bb6bc49696 |
|
MD5 | 3147d10d60d1962784ffc5bef7dd925a |
|
BLAKE2b-256 | 62abb650d35d3f7049e4f5903b420e915de1c2df3ad9a7cef6dc1ab4c7556e2d |