mcab 0.1.0__py3-none-any.whl
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.
- mcab/__init__.py +149 -0
- mcab/core.py +2740 -0
- mcab/effects.py +518 -0
- mcab/mstats.py +1644 -0
- mcab/plots.py +1222 -0
- mcab/tests.py +594 -0
- mcab/transform.py +666 -0
- mcab/utils.py +54 -0
- mcab-0.1.0.dist-info/METADATA +49 -0
- mcab-0.1.0.dist-info/RECORD +13 -0
- mcab-0.1.0.dist-info/WHEEL +5 -0
- mcab-0.1.0.dist-info/licenses/LICENSE +21 -0
- mcab-0.1.0.dist-info/top_level.txt +1 -0
mcab/__init__.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""
|
|
2
|
+
mcab - Monte Carlo A/B Testing Library
|
|
3
|
+
========================================
|
|
4
|
+
|
|
5
|
+
A comprehensive Python library for A/B testing design and analysis using Monte Carlo simulations.
|
|
6
|
+
|
|
7
|
+
Main Components
|
|
8
|
+
---------------
|
|
9
|
+
- RandomData: Generate synthetic data for testing
|
|
10
|
+
- AaDataIid: Handle independent (user-aggregated) data
|
|
11
|
+
- AaDataRatio: Handle ratio metrics (CTR, average check, etc.)
|
|
12
|
+
- AaDataDept1s: Handle dependent one-sample data with an artificial control
|
|
13
|
+
- DesignerIid: Design A/B tests for independent data
|
|
14
|
+
- DesignerRatio: Design A/B tests for ratio metrics
|
|
15
|
+
- DesignerRatioLin: Design A/B tests for linearized ratio metrics
|
|
16
|
+
- DesignerDept1s: Design A/B tests for dependent one-sample data
|
|
17
|
+
- BenchMarker: Compare multiple A/B test designs
|
|
18
|
+
|
|
19
|
+
Statistical Tests
|
|
20
|
+
-----------------
|
|
21
|
+
- bootstrap_1s, bootstrap_2s: Bootstrap hypothesis tests
|
|
22
|
+
- sign_permutation_test: Paired permutation test
|
|
23
|
+
- permutation_test_2s: Two-sample permutation test
|
|
24
|
+
- multiple_pvalue_correction: Multiple testing corrections
|
|
25
|
+
|
|
26
|
+
Example Usage
|
|
27
|
+
-------------
|
|
28
|
+
>>> from mcab import RandomData, AaDataIid, DesignerIid
|
|
29
|
+
>>> from scipy import stats
|
|
30
|
+
>>>
|
|
31
|
+
>>> # Generate data
|
|
32
|
+
>>> rd = RandomData(seed=42)
|
|
33
|
+
>>> data = rd.normal_data(size=10000, mean=100, std=30)
|
|
34
|
+
>>>
|
|
35
|
+
>>> # Create designer
|
|
36
|
+
>>> target = AaDataIid(data)
|
|
37
|
+
>>> designer = DesignerIid(target, alpha=0.05)
|
|
38
|
+
>>>
|
|
39
|
+
>>> # Run AA simulations
|
|
40
|
+
>>> pvals = designer.aa_sims(
|
|
41
|
+
... pval_func=lambda t, c: stats.ttest_ind(t, c).pvalue,
|
|
42
|
+
... n_sims=1000
|
|
43
|
+
... )
|
|
44
|
+
>>>
|
|
45
|
+
>>> # Find MDE
|
|
46
|
+
>>> mde_result = designer.find_mde(
|
|
47
|
+
... pval_func=lambda t, c: stats.ttest_ind(t, c).pvalue,
|
|
48
|
+
... target_power=0.8
|
|
49
|
+
... )
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
__version__ = "0.1.0"
|
|
53
|
+
__author__ = "Sergey Lastochkin"
|
|
54
|
+
|
|
55
|
+
# Core classes
|
|
56
|
+
from .core import (
|
|
57
|
+
RandomData,
|
|
58
|
+
AaDataIid,
|
|
59
|
+
AaDataRatio,
|
|
60
|
+
AaDataDept1s,
|
|
61
|
+
DesignerIid,
|
|
62
|
+
DesignerRatio,
|
|
63
|
+
DesignerRatioLin,
|
|
64
|
+
DesignerDept1s,
|
|
65
|
+
BenchMarker,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
from .effects import (
|
|
69
|
+
PercentEffectSizer,
|
|
70
|
+
ConstantEffectSizer,
|
|
71
|
+
CustomEffectSizer,
|
|
72
|
+
FunctionEffectSizer
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Utility classes
|
|
76
|
+
from .utils import ProgressParallel
|
|
77
|
+
|
|
78
|
+
# Statistical functions
|
|
79
|
+
from .mstats import (
|
|
80
|
+
# Enums
|
|
81
|
+
Alternative,
|
|
82
|
+
# Utilities
|
|
83
|
+
apply_statistic,
|
|
84
|
+
# Bootstrap tests
|
|
85
|
+
bootstrap_1s,
|
|
86
|
+
bootstrap_2s,
|
|
87
|
+
# Permutation tests
|
|
88
|
+
sign_permutation_test,
|
|
89
|
+
permutation_test_2s,
|
|
90
|
+
# Multiple testing corrections
|
|
91
|
+
multiple_pvalue_correction,
|
|
92
|
+
CORRECTION_METHODS,
|
|
93
|
+
bonferroni,
|
|
94
|
+
holm_bonferroni,
|
|
95
|
+
hochberg,
|
|
96
|
+
benjamini_hochberg,
|
|
97
|
+
benjamini_yekutieli,
|
|
98
|
+
benjamini_krieger_yekutieli,
|
|
99
|
+
sidak,
|
|
100
|
+
holm_sidak,
|
|
101
|
+
no_multiple_correction,
|
|
102
|
+
delta_method_pvalue
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
__all__ = [
|
|
106
|
+
# Version
|
|
107
|
+
'__version__',
|
|
108
|
+
# Core classes
|
|
109
|
+
'RandomData',
|
|
110
|
+
'AaDataIid',
|
|
111
|
+
'AaDataRatio',
|
|
112
|
+
'AaDataDept1s',
|
|
113
|
+
'DesignerIid',
|
|
114
|
+
'DesignerRatio',
|
|
115
|
+
'DesignerRatioLin',
|
|
116
|
+
'DesignerDept1s',
|
|
117
|
+
'BenchMarker',
|
|
118
|
+
# Effects
|
|
119
|
+
'PercentEffectSizer',
|
|
120
|
+
'ConstantEffectSizer',
|
|
121
|
+
'CustomEffectSizer',
|
|
122
|
+
'FunctionEffectSizer',
|
|
123
|
+
# Utilities
|
|
124
|
+
'ProgressParallel',
|
|
125
|
+
# Enums
|
|
126
|
+
'Alternative',
|
|
127
|
+
# Statistical utilities
|
|
128
|
+
'apply_statistic',
|
|
129
|
+
# Bootstrap tests
|
|
130
|
+
'bootstrap_1s',
|
|
131
|
+
'bootstrap_2s',
|
|
132
|
+
# Permutation tests
|
|
133
|
+
'sign_permutation_test',
|
|
134
|
+
'permutation_test_2s',
|
|
135
|
+
# delta method
|
|
136
|
+
'delta_method_pvalue',
|
|
137
|
+
# Multiple testing
|
|
138
|
+
'multiple_pvalue_correction',
|
|
139
|
+
'CORRECTION_METHODS',
|
|
140
|
+
'bonferroni',
|
|
141
|
+
'holm_bonferroni',
|
|
142
|
+
'hochberg',
|
|
143
|
+
'benjamini_hochberg',
|
|
144
|
+
'benjamini_yekutieli',
|
|
145
|
+
'benjamini_krieger_yekutieli',
|
|
146
|
+
'sidak',
|
|
147
|
+
'holm_sidak',
|
|
148
|
+
'no_multiple_correction'
|
|
149
|
+
]
|