Skip to main content

AutoStatLib - a simple statistical analysis tool

Project description

AutoStatLib - python library for automated statistical analysis

pypi_version GitHub Release PyPI - License Python PyPI - Downloads

To install run the command:

pip install autostatlib

Example use case:

See the /demo directory on Git repo or
use the following example:

import numpy as np
import AutoStatLib

# generate random data:
groups = 2
n = 30

# normal data
data_norm = [list(np.random.normal(.5*i + 4, abs(1-.2*i), n))
        for i in range(groups)]

# non-normal data
data_uniform = [list(np.random.uniform(i+3, i+1, n)) for i in range(groups)]


# set the parameters:
paired = False     # is groups dependent or not
tails = 2          # two-tailed or one-tailed result
popmean = 0        # population mean - only for single-sample tests needed

# initiate the analysis
analysis = AutoStatLib.StatisticalAnalysis(
    data_norm, paired=paired, tails=tails, popmean=popmean)

now you can preform automated statistical test selection:

analysis.RunAuto()

or you can choose specific tests:

# 2 groups independent:
analysis.RunTtest()
analysis.RunMannWhitney()

# 2 groups paired"
analysis.RunTtestPaired()
analysis.RunWilcoxon()

# 3 and more independed groups comparison:
analysis.RunOnewayAnova()
analysis.RunKruskalWallis()

# 3 and more depended groups comparison:
analysis.RunOnewayAnovaRM()
analysis.RunFriedman()

# single group tests"
analysis.RunTtestSingleSample()
analysis.RunWilcoxonSingleSample()

Test summary will be printed to the console. You can also get it as a python string via GetSummary() method.


Test results are accessible as a dictionary via GetResult() method:

results = analysis.GetResult()

The results dictionary keys with representing value types:

{
    'p-value' :                    String
    'Significance(p<0.05)' :       Boolean
    'Stars_Printed' :              String
    'Test_Name' :                  String
    'Groups_Compared' :            Integer
    'Population_Mean' :            Float   (taken from the input)
    'Data_Normaly_Distributed' :   Boolean
    'Parametric_Test_Applied' :    Boolean
    'Paired_Test_Applied' :        Boolean
    'Tails' :                      Integer (taken from the input)
    'p-value_exact' :              Float
    'Stars' :                      Integer
    'Warnings' :                   String
    'Groups_N' :                   List of integers
    'Groups_Median' :              List of floats
    'Groups_Mean' :                List of floats
    'Groups_SD' :                  List of floats
    'Groups_SE' :                  List of floats
    'Samples' :                    List of input values by groups
                                           (taken from the input)
    'Posthoc_Matrix' :             2D List of floats
    'Posthoc_Matrix_bool' :        2D List of Boolean
    'Posthoc_Matrix_printed':      2D List of String
    'Posthoc_Matrix_stars':        2D List of String
}

If errors occured, GetResult() returns an empty dictionary


Pre-Alpha dev status.

TODO:

-- Anova: posthocs
-- Anova: add 2-way anova and 3-way anova
-- onevay Anova: add repeated measures (for normal dependent values) with and without Gaisser-Greenhouse correction
-- onevay Anova: add Brown-Forsithe and Welch (for normal independent values with unequal SDs between groups)
-- paired T-test: add ratio-paired t-test (ratios of paired values are consistent)
-- add Welch test (for norm data unequal variances) -- add Kolmogorov-smirnov test (unpaired nonparametric 2 sample, compare cumulative distributions)
-- add independent t-test with Welch correction (do not assume equal SDs in groups)
-- add correlation test, correlation diagram
-- add linear regression, regression diagram
-- add QQ plot -- n-sample tests: add onetail option

✅ done -- detailed normality test results
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons

tests check:
1-sample:
--Wilcoxon 2,1 tails - ok
--t-tests 2,1 tails -ok

2-sample:
--Wilcoxon 2,1 tails - ok
--Mann-whitney 2,1 tails - ok
--t-tests 2,1 tails -ok

n-sample:
--Kruskal-Wallis 2 tail - ok
--Dunn's multiple comparisons - ?? --Friedman 2 tail - ok
--one-way ANOWA 2 tail - ok

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

autostatlib-0.2.12.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

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

autostatlib-0.2.12-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file autostatlib-0.2.12.tar.gz.

File metadata

  • Download URL: autostatlib-0.2.12.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for autostatlib-0.2.12.tar.gz
Algorithm Hash digest
SHA256 f2c41f0e606ec9b8da6f5ae451cf2c8e92e92d5404e77cc6695594994d712628
MD5 8a267f98a0ea984ba504fa563a0b35aa
BLAKE2b-256 71822e1013c9974092c68e894b39ea3fff67a000ef8c80923c4f150a11626297

See more details on using hashes here.

Provenance

The following attestation bundles were made for autostatlib-0.2.12.tar.gz:

Publisher: python-publish.yml on konung-yaropolk/AutoStatLib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autostatlib-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: autostatlib-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for autostatlib-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8977fe1ce97792052f42ff81ca12a2132a6d82d7ce48a53500301b09de1b7274
MD5 5ac7023f451da14b6464e252fcddf209
BLAKE2b-256 696f71deeb4d828b248e0a51a3990a8fc30cf31a44cceab3b1d05a93b3a17118

See more details on using hashes here.

Provenance

The following attestation bundles were made for autostatlib-0.2.12-py3-none-any.whl:

Publisher: python-publish.yml on konung-yaropolk/AutoStatLib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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