AutoStatLib 0.2.14__tar.gz → 0.2.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of AutoStatLib might be problematic. Click here for more details.
- {autostatlib-0.2.14/src/AutoStatLib.egg-info → autostatlib-0.2.18}/PKG-INFO +16 -15
- {autostatlib-0.2.14 → autostatlib-0.2.18}/README.md +14 -14
- {autostatlib-0.2.14 → autostatlib-0.2.18}/requirements.txt +1 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/StatPlots.py +109 -28
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/_version.py +1 -1
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/helpers.py +10 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/statistical_tests.py +6 -6
- {autostatlib-0.2.14 → autostatlib-0.2.18/src/AutoStatLib.egg-info}/PKG-INFO +16 -15
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib.egg-info/requires.txt +1 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/LICENSE +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/MANIFEST.in +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/pyproject.toml +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/setup.cfg +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/AutoStatLib.py +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/__init__.py +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/__main__.py +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/normality_tests.py +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib/text_formatting.py +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib.egg-info/SOURCES.txt +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib.egg-info/dependency_links.txt +0 -0
- {autostatlib-0.2.14 → autostatlib-0.2.18}/src/AutoStatLib.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoStatLib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.18
|
|
4
4
|
Summary: AutoStatLib - a simple statistical analysis tool
|
|
5
5
|
Author: Stemonitis, SciWare LLC
|
|
6
6
|
Author-email: konung-yaropolk <yaropolk1995@gmail.com>
|
|
@@ -533,6 +533,7 @@ Requires-Dist: numpy
|
|
|
533
533
|
Requires-Dist: scipy
|
|
534
534
|
Requires-Dist: statsmodels
|
|
535
535
|
Requires-Dist: matplotlib
|
|
536
|
+
Requires-Dist: seaborn
|
|
536
537
|
Requires-Dist: scikit-posthocs
|
|
537
538
|
Requires-Dist: pandas
|
|
538
539
|
Dynamic: license-file
|
|
@@ -672,25 +673,25 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
672
673
|
-- add independent t-test with Welch correction (do not assume equal SDs in groups)
|
|
673
674
|
-- add correlation test, correlation diagram
|
|
674
675
|
-- add linear regression, regression diagram
|
|
675
|
-
-- add QQ plot
|
|
676
|
-
-- n-sample tests: add onetail option
|
|
676
|
+
-- add QQ plot
|
|
677
|
+
-- n-sample tests: add onetail option
|
|
677
678
|
|
|
678
|
-
✅ done -- detailed normality test results
|
|
679
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
679
|
+
✅ done -- detailed normality test results
|
|
680
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
680
681
|
|
|
681
682
|
tests check:
|
|
682
683
|
1-sample:
|
|
683
|
-
--Wilcoxon 2,1 tails
|
|
684
|
-
--t-tests 2,1 tails
|
|
684
|
+
✅ok --Wilcoxon 2,1 tails
|
|
685
|
+
✅ok --t-tests 2,1 tails
|
|
685
686
|
|
|
686
687
|
2-sample:
|
|
687
|
-
--Wilcoxon 2,1 tails
|
|
688
|
-
--Mann-whitney 2,1 tails
|
|
689
|
-
--t-tests 2,1 tails
|
|
688
|
+
✅ok --Wilcoxon 2,1 tails
|
|
689
|
+
✅ok --Mann-whitney 2,1 tails
|
|
690
|
+
✅ok --t-tests 2,1 tails
|
|
690
691
|
|
|
691
692
|
n-sample:
|
|
692
|
-
--Kruskal-Wallis 2 tail
|
|
693
|
-
--Dunn's multiple comparisons
|
|
694
|
-
--Friedman 2 tail
|
|
695
|
-
--one-way ANOWA 2 tail
|
|
696
|
-
--Tukey`s multiple comparisons
|
|
693
|
+
✅ok --Kruskal-Wallis 2 tail
|
|
694
|
+
✅ok --Dunn's multiple comparisons
|
|
695
|
+
✅ok --Friedman 2 tail
|
|
696
|
+
✅ok --one-way ANOWA 2 tail
|
|
697
|
+
✅ok --Tukey`s multiple comparisons
|
|
@@ -133,25 +133,25 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
133
133
|
-- add independent t-test with Welch correction (do not assume equal SDs in groups)
|
|
134
134
|
-- add correlation test, correlation diagram
|
|
135
135
|
-- add linear regression, regression diagram
|
|
136
|
-
-- add QQ plot
|
|
137
|
-
-- n-sample tests: add onetail option
|
|
136
|
+
-- add QQ plot
|
|
137
|
+
-- n-sample tests: add onetail option
|
|
138
138
|
|
|
139
|
-
✅ done -- detailed normality test results
|
|
140
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
139
|
+
✅ done -- detailed normality test results
|
|
140
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
141
141
|
|
|
142
142
|
tests check:
|
|
143
143
|
1-sample:
|
|
144
|
-
--Wilcoxon 2,1 tails
|
|
145
|
-
--t-tests 2,1 tails
|
|
144
|
+
✅ok --Wilcoxon 2,1 tails
|
|
145
|
+
✅ok --t-tests 2,1 tails
|
|
146
146
|
|
|
147
147
|
2-sample:
|
|
148
|
-
--Wilcoxon 2,1 tails
|
|
149
|
-
--Mann-whitney 2,1 tails
|
|
150
|
-
--t-tests 2,1 tails
|
|
148
|
+
✅ok --Wilcoxon 2,1 tails
|
|
149
|
+
✅ok --Mann-whitney 2,1 tails
|
|
150
|
+
✅ok --t-tests 2,1 tails
|
|
151
151
|
|
|
152
152
|
n-sample:
|
|
153
|
-
--Kruskal-Wallis 2 tail
|
|
154
|
-
--Dunn's multiple comparisons
|
|
155
|
-
--Friedman 2 tail
|
|
156
|
-
--one-way ANOWA 2 tail
|
|
157
|
-
--Tukey`s multiple comparisons
|
|
153
|
+
✅ok --Kruskal-Wallis 2 tail
|
|
154
|
+
✅ok --Dunn's multiple comparisons
|
|
155
|
+
✅ok --Friedman 2 tail
|
|
156
|
+
✅ok --one-way ANOWA 2 tail
|
|
157
|
+
✅ok --Tukey`s multiple comparisons
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import seaborn as sns
|
|
1
2
|
import random
|
|
2
3
|
# from math import comb
|
|
3
4
|
import numpy as np
|
|
@@ -149,31 +150,6 @@ class BaseStatPlot(Helpers):
|
|
|
149
150
|
|
|
150
151
|
return fig, ax
|
|
151
152
|
|
|
152
|
-
def add_scatter(self, ax,
|
|
153
|
-
color='k',
|
|
154
|
-
alpha=0.5,
|
|
155
|
-
marker='o',
|
|
156
|
-
markersize=6,
|
|
157
|
-
linewidth=1,
|
|
158
|
-
zorder=1):
|
|
159
|
-
# Generate x jitter pool.
|
|
160
|
-
spread_pool = [] # storing x positions of data points
|
|
161
|
-
for i, data in enumerate(self.data_groups):
|
|
162
|
-
spread = tuple(random.uniform(-.10, .10) for _ in data)
|
|
163
|
-
spread_pool.append(tuple(i + s for s in spread))
|
|
164
|
-
|
|
165
|
-
for i, data in enumerate(self.transpose(self.data_groups)):
|
|
166
|
-
# Plot individual data points with x jitter.
|
|
167
|
-
ax.plot(self.transpose(spread_pool)[i], data,
|
|
168
|
-
color=color,
|
|
169
|
-
alpha=alpha,
|
|
170
|
-
marker=marker,
|
|
171
|
-
markersize=markersize*self.figure_scale_factor,
|
|
172
|
-
linewidth=linewidth*self.figure_scale_factor,
|
|
173
|
-
# Connect the data points if desired.
|
|
174
|
-
linestyle='-' if self.dependent else '',
|
|
175
|
-
zorder=zorder)
|
|
176
|
-
|
|
177
153
|
def add_barplot(self, ax, x,
|
|
178
154
|
fill=True,
|
|
179
155
|
linewidth=2,
|
|
@@ -359,6 +335,83 @@ class BaseStatPlot(Helpers):
|
|
|
359
335
|
patch.set_facecolor(
|
|
360
336
|
self.colors_fill[x % len(self.colors_fill)])
|
|
361
337
|
|
|
338
|
+
def add_scatter(self, ax,
|
|
339
|
+
color='k',
|
|
340
|
+
alpha=0.5,
|
|
341
|
+
marker='o',
|
|
342
|
+
markersize=8,
|
|
343
|
+
linewidth=1.2,
|
|
344
|
+
zorder=2):
|
|
345
|
+
# Generate x jitter pool.
|
|
346
|
+
spread_pool = [] # storing x positions of data points
|
|
347
|
+
for i, data in enumerate(self.data_groups):
|
|
348
|
+
spread = tuple(random.uniform(-.10, .10) for _ in data)
|
|
349
|
+
spread_pool.append(tuple(i + s for s in spread))
|
|
350
|
+
|
|
351
|
+
for i, data in enumerate(self.transpose(self.data_groups)):
|
|
352
|
+
# Plot individual data points with x jitter.
|
|
353
|
+
ax.plot(self.transpose(spread_pool)[i], data,
|
|
354
|
+
color=color,
|
|
355
|
+
alpha=alpha,
|
|
356
|
+
marker=marker,
|
|
357
|
+
markersize=markersize*self.figure_scale_factor,
|
|
358
|
+
linewidth=linewidth*self.figure_scale_factor,
|
|
359
|
+
# Connect the data points if desired.
|
|
360
|
+
linestyle='-' if self.dependent else '',
|
|
361
|
+
zorder=zorder-1)
|
|
362
|
+
|
|
363
|
+
def add_swarm(self, ax,
|
|
364
|
+
color='grey',
|
|
365
|
+
alpha=1,
|
|
366
|
+
marker='o',
|
|
367
|
+
markersize=8,
|
|
368
|
+
linewidth=1.4,
|
|
369
|
+
zorder=2):
|
|
370
|
+
"""
|
|
371
|
+
Add a swarmplot (scatter-like plot with non-overlapping points)
|
|
372
|
+
to the provided Axes. Automatically reduce point size if overcrowded.
|
|
373
|
+
"""
|
|
374
|
+
|
|
375
|
+
# Prepare flattened data
|
|
376
|
+
values = [v for i, group in enumerate(self.data_groups) for v in group]
|
|
377
|
+
groups = [i for i, group in enumerate(self.data_groups) for _ in group]
|
|
378
|
+
|
|
379
|
+
# Estimate overcrowding for adaptive sizing
|
|
380
|
+
group_counts = [len(g) for g in self.data_groups]
|
|
381
|
+
max_points = max(group_counts) if group_counts else 1
|
|
382
|
+
|
|
383
|
+
# Determine horizontal space per category
|
|
384
|
+
num_groups = len(self.data_groups)
|
|
385
|
+
xlim = ax.get_xlim()
|
|
386
|
+
width_per_group = (xlim[1] - xlim[0]) / max(num_groups, 1)
|
|
387
|
+
|
|
388
|
+
# Empirical density threshold: if points are too dense, shrink
|
|
389
|
+
density = max_points / (width_per_group + 1e-6)
|
|
390
|
+
|
|
391
|
+
# Tunable constants to approximate best function of size adjustment
|
|
392
|
+
size_scale = max(0.1, min(1, 3.5 / (density ** 0.5)))
|
|
393
|
+
|
|
394
|
+
sns.swarmplot(
|
|
395
|
+
x=groups,
|
|
396
|
+
y=values,
|
|
397
|
+
ax=ax,
|
|
398
|
+
color=color,
|
|
399
|
+
alpha=alpha,
|
|
400
|
+
size=markersize * self.figure_scale_factor * size_scale,
|
|
401
|
+
marker=marker,
|
|
402
|
+
linewidth=linewidth * self.figure_scale_factor * size_scale,
|
|
403
|
+
zorder=zorder,
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
# Connect points if data paired
|
|
407
|
+
if self.dependent == True:
|
|
408
|
+
for i, data in enumerate(self.transpose(self.data_groups)):
|
|
409
|
+
ax.plot(range(len(data)), data,
|
|
410
|
+
color=color,
|
|
411
|
+
alpha=alpha * 0.7,
|
|
412
|
+
linewidth=linewidth * self.figure_scale_factor,
|
|
413
|
+
zorder=zorder - 1)
|
|
414
|
+
|
|
362
415
|
def add_errorbar_sd(self, ax, x,
|
|
363
416
|
capsize=8,
|
|
364
417
|
ecolor='r',
|
|
@@ -589,7 +642,7 @@ class BarStatPlot(BaseStatPlot):
|
|
|
589
642
|
self.add_mean_marker(ax, x)
|
|
590
643
|
self.add_errorbar_sd(ax, x)
|
|
591
644
|
|
|
592
|
-
self.
|
|
645
|
+
self.add_swarm(ax)
|
|
593
646
|
self.add_significance_bars(ax, linewidth)
|
|
594
647
|
self.add_titles_and_labels(fig, ax)
|
|
595
648
|
self.axes_formatting(ax, linewidth)
|
|
@@ -622,11 +675,14 @@ class ViolinStatPlot(BaseStatPlot):
|
|
|
622
675
|
self.add_mean_marker(ax, x)
|
|
623
676
|
# self.add_errorbar_sd(ax, x)
|
|
624
677
|
|
|
625
|
-
self.
|
|
678
|
+
self.add_swarm(ax)
|
|
626
679
|
self.add_significance_bars(ax, linewidth)
|
|
627
680
|
self.add_titles_and_labels(fig, ax)
|
|
628
681
|
self.axes_formatting(ax, linewidth)
|
|
629
682
|
|
|
683
|
+
xmin, xmax = ax.get_xlim()
|
|
684
|
+
ax.set_xlim(xmin - 0.3, xmax + 0.3)
|
|
685
|
+
|
|
630
686
|
|
|
631
687
|
class BoxStatPlot(BaseStatPlot):
|
|
632
688
|
|
|
@@ -635,7 +691,7 @@ class BoxStatPlot(BaseStatPlot):
|
|
|
635
691
|
linewidth = 2
|
|
636
692
|
|
|
637
693
|
self.add_boxplot(ax)
|
|
638
|
-
self.
|
|
694
|
+
self.add_swarm(ax)
|
|
639
695
|
self.add_significance_bars(ax, linewidth)
|
|
640
696
|
self.add_titles_and_labels(fig, ax)
|
|
641
697
|
self.axes_formatting(ax, linewidth)
|
|
@@ -658,3 +714,28 @@ class ScatterStatPlot(BaseStatPlot):
|
|
|
658
714
|
self.add_significance_bars(ax, linewidth)
|
|
659
715
|
self.add_titles_and_labels(fig, ax)
|
|
660
716
|
self.axes_formatting(ax, linewidth)
|
|
717
|
+
|
|
718
|
+
xmin, xmax = ax.get_xlim()
|
|
719
|
+
ax.set_xlim(xmin - 0.3, xmax + 0.3)
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class SwarmStatPlot(BaseStatPlot):
|
|
723
|
+
|
|
724
|
+
def plot(self):
|
|
725
|
+
fig, ax = self.setup_figure()
|
|
726
|
+
linewidth = 2
|
|
727
|
+
|
|
728
|
+
for x in range(len(self.data_groups)):
|
|
729
|
+
|
|
730
|
+
# Overlay errbars, and markers.
|
|
731
|
+
self.add_median_marker(ax, x)
|
|
732
|
+
self.add_mean_marker(ax, x)
|
|
733
|
+
self.add_errorbar_sd(ax, x)
|
|
734
|
+
|
|
735
|
+
self.add_swarm(ax)
|
|
736
|
+
self.add_significance_bars(ax, linewidth)
|
|
737
|
+
self.add_titles_and_labels(fig, ax)
|
|
738
|
+
self.axes_formatting(ax, linewidth)
|
|
739
|
+
|
|
740
|
+
xmin, xmax = ax.get_xlim()
|
|
741
|
+
ax.set_xlim(xmin - 0.3, xmax + 0.3)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# AutoStatLib package version:
|
|
2
|
-
__version__ = "0.2.
|
|
2
|
+
__version__ = "0.2.18"
|
|
@@ -21,6 +21,16 @@ class Helpers():
|
|
|
21
21
|
{'Row': rows, 'Col': cols, 'Value': data})
|
|
22
22
|
return df
|
|
23
23
|
|
|
24
|
+
def list_to_matrix(self, list, n):
|
|
25
|
+
i = 0
|
|
26
|
+
matrix = [[1.0 for _ in range(n)] for _ in range(n)]
|
|
27
|
+
for ax0 in range(n):
|
|
28
|
+
for ax1 in range(ax0+1, n):
|
|
29
|
+
matrix[ax0][ax1] = list[i]
|
|
30
|
+
matrix[ax1][ax0] = list[i]
|
|
31
|
+
i += 1
|
|
32
|
+
return matrix
|
|
33
|
+
|
|
24
34
|
def floatify_recursive(self, data):
|
|
25
35
|
if isinstance(data, list):
|
|
26
36
|
# Recursively process sublists and filter out None values
|
|
@@ -99,12 +99,12 @@ class StatisticalTests():
|
|
|
99
99
|
[[f"Group_{i+1}"] * len(group) for i, group in enumerate(self.data)])
|
|
100
100
|
# Tukey's multiple comparisons
|
|
101
101
|
tukey_result = pairwise_tukeyhsd(data_flat, group_labels)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
|
|
103
|
+
list = tukey_result.pvalues.tolist()
|
|
104
|
+
n = self.n_groups
|
|
105
|
+
# prepare posthoc matrix
|
|
106
|
+
self.posthoc_matrix = self.list_to_matrix(list, n)
|
|
107
|
+
|
|
108
108
|
return stat, p_value
|
|
109
109
|
|
|
110
110
|
def anova_1w_rm(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoStatLib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.18
|
|
4
4
|
Summary: AutoStatLib - a simple statistical analysis tool
|
|
5
5
|
Author: Stemonitis, SciWare LLC
|
|
6
6
|
Author-email: konung-yaropolk <yaropolk1995@gmail.com>
|
|
@@ -533,6 +533,7 @@ Requires-Dist: numpy
|
|
|
533
533
|
Requires-Dist: scipy
|
|
534
534
|
Requires-Dist: statsmodels
|
|
535
535
|
Requires-Dist: matplotlib
|
|
536
|
+
Requires-Dist: seaborn
|
|
536
537
|
Requires-Dist: scikit-posthocs
|
|
537
538
|
Requires-Dist: pandas
|
|
538
539
|
Dynamic: license-file
|
|
@@ -672,25 +673,25 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
672
673
|
-- add independent t-test with Welch correction (do not assume equal SDs in groups)
|
|
673
674
|
-- add correlation test, correlation diagram
|
|
674
675
|
-- add linear regression, regression diagram
|
|
675
|
-
-- add QQ plot
|
|
676
|
-
-- n-sample tests: add onetail option
|
|
676
|
+
-- add QQ plot
|
|
677
|
+
-- n-sample tests: add onetail option
|
|
677
678
|
|
|
678
|
-
✅ done -- detailed normality test results
|
|
679
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
679
|
+
✅ done -- detailed normality test results
|
|
680
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
680
681
|
|
|
681
682
|
tests check:
|
|
682
683
|
1-sample:
|
|
683
|
-
--Wilcoxon 2,1 tails
|
|
684
|
-
--t-tests 2,1 tails
|
|
684
|
+
✅ok --Wilcoxon 2,1 tails
|
|
685
|
+
✅ok --t-tests 2,1 tails
|
|
685
686
|
|
|
686
687
|
2-sample:
|
|
687
|
-
--Wilcoxon 2,1 tails
|
|
688
|
-
--Mann-whitney 2,1 tails
|
|
689
|
-
--t-tests 2,1 tails
|
|
688
|
+
✅ok --Wilcoxon 2,1 tails
|
|
689
|
+
✅ok --Mann-whitney 2,1 tails
|
|
690
|
+
✅ok --t-tests 2,1 tails
|
|
690
691
|
|
|
691
692
|
n-sample:
|
|
692
|
-
--Kruskal-Wallis 2 tail
|
|
693
|
-
--Dunn's multiple comparisons
|
|
694
|
-
--Friedman 2 tail
|
|
695
|
-
--one-way ANOWA 2 tail
|
|
696
|
-
--Tukey`s multiple comparisons
|
|
693
|
+
✅ok --Kruskal-Wallis 2 tail
|
|
694
|
+
✅ok --Dunn's multiple comparisons
|
|
695
|
+
✅ok --Friedman 2 tail
|
|
696
|
+
✅ok --one-way ANOWA 2 tail
|
|
697
|
+
✅ok --Tukey`s multiple comparisons
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|