ABalytics 2.0.0__tar.gz → 2.1.1__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.
- {abalytics-2.0.0 → abalytics-2.1.1}/PKG-INFO +60 -31
- abalytics-2.1.1/README.md +117 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics/utils.py +27 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics.egg-info/PKG-INFO +60 -31
- {abalytics-2.0.0 → abalytics-2.1.1}/setup.py +1 -1
- abalytics-2.0.0/README.md +0 -88
- {abalytics-2.0.0 → abalytics-2.1.1}/LICENSE +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics/__init__.py +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics/analysis.py +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics/significance_tests.py +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics.egg-info/SOURCES.txt +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics.egg-info/dependency_links.txt +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics.egg-info/requires.txt +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/abalytics.egg-info/top_level.txt +0 -0
- {abalytics-2.0.0 → abalytics-2.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: abalytics
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Advanced A/B Testing Statistical Analytics
|
|
5
5
|
Author: Janis Berneker
|
|
6
6
|
License: LICENSE
|
|
@@ -24,6 +24,7 @@ ABalytics is a Python package designed for statistical analysis, particularly fo
|
|
|
24
24
|
- **Significance Tests**: Includes a variety of significance tests such as Chi-Square, Welch's ANOVA, and Kruskal-Wallis, to accurately determine the significance of results.
|
|
25
25
|
- **Posthoc Analysis**: Offers posthoc analysis methods like Tukey's HSD, Dunn's test, and Games-Howell, for detailed examination following significance tests.
|
|
26
26
|
- **Normality and Homogeneity Checks**: Performs checks for Gaussian distribution and homogeneity of variances using Levene's test, which are critical for selecting the right tests.
|
|
27
|
+
- **Data Transformation**: Provides functionality to convert data from long to wide format, facilitating analysis of dependent groups.
|
|
27
28
|
- **Pretty Text Output**: Generates a formatted text output with the results of the statistical tests, facilitating interpretation and reporting.
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
@@ -34,65 +35,93 @@ pip install abalytics
|
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
## Usage
|
|
38
|
+
### Analyzing Results
|
|
39
|
+
|
|
40
|
+
ABalytics provides two main functions for analyzing A/B testing results: `analyze_independent_groups` and `analyze_dependent_groups`.
|
|
41
|
+
|
|
42
|
+
#### Independent Groups Analysis
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
`analyze_independent_groups` is used for analyzing data where the groups are independent of each other. It takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and optional parameters for p-value threshold and minimum sample size.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
39
47
|
```python
|
|
40
|
-
import
|
|
48
|
+
from abalytics import analyze_independent_groups
|
|
49
|
+
import pandas as pd
|
|
50
|
+
|
|
51
|
+
# Load your data into a pandas DataFrame
|
|
52
|
+
df = pd.read_csv('your_data.csv')
|
|
53
|
+
|
|
54
|
+
# Analyze the results
|
|
55
|
+
analysis_results = analyze_independent_groups(
|
|
56
|
+
df,
|
|
57
|
+
variable_to_analyze="order_value",
|
|
58
|
+
group_column="ab_test_group",
|
|
59
|
+
)
|
|
41
60
|
```
|
|
42
61
|
|
|
43
|
-
### Analyzing Results
|
|
44
62
|
|
|
45
|
-
|
|
46
|
-
`analyze_independent_groups` takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
47
|
-
`analyze_dependent_groups` takes a pandas DataFrame, the names of the columns to compare, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
63
|
+
#### Dependent Groups Analysis
|
|
48
64
|
|
|
49
|
-
|
|
65
|
+
`analyze_dependent_groups` is used for analyzing data where the groups are dependent, such as repeated measures on the same subjects. It requires data in wide format. If your data is in long format, you can use the `convert_long_to_wide` function in `abalytics.utils` to convert it. The `analyze_dependent_groups` function takes a pandas DataFrame, the names of the columns to compare, and optional parameters for p-value threshold and minimum sample size.
|
|
66
|
+
|
|
67
|
+
Example:
|
|
50
68
|
```python
|
|
51
|
-
import
|
|
69
|
+
from abalytics import analyze_dependent_groups
|
|
52
70
|
import pandas as pd
|
|
53
71
|
|
|
54
|
-
#Load your data into a pandas DataFrame
|
|
72
|
+
# Load your data into a pandas DataFrame
|
|
55
73
|
df = pd.read_csv('your_data.csv')
|
|
56
74
|
|
|
57
|
-
#Analyze the results
|
|
58
|
-
analysis_results =
|
|
75
|
+
# Analyze the results
|
|
76
|
+
analysis_results = analyze_dependent_groups(
|
|
59
77
|
df,
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
variables_to_compare=["pre_test_score", "post_test_score"],
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Data Transformation
|
|
83
|
+
|
|
84
|
+
The `convert_long_to_wide` function in `abalytics.utils` is designed to transform data from long format to wide format, with an option to keep multi-level columns or flatten them. `analyze_dependent_groups` requires data in wide format to operate correctly.
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
```python
|
|
88
|
+
from abalytics.utils import convert_long_to_wide
|
|
89
|
+
import pandas as pd
|
|
90
|
+
|
|
91
|
+
# Assuming 'df_long' is your pandas DataFrame in long format
|
|
92
|
+
df_wide = convert_long_to_wide(
|
|
93
|
+
df_long,
|
|
94
|
+
index_col="subject_id",
|
|
95
|
+
columns_col="condition",
|
|
96
|
+
flatten_columns=True # Set to False if you wish to keep multi-level columns
|
|
62
97
|
)
|
|
63
98
|
```
|
|
64
|
-
The `get_results` function will return an `AnalysisResults` object containing the following attributes:
|
|
65
|
-
- `significant_results`: A list of results of the statistical significance tests.
|
|
66
|
-
- `info`: A string containing information about the data if no results were found.
|
|
67
|
-
- `sample_size`: The sample size of the data.
|
|
68
|
-
- `dichotomous_flag`: A boolean flag indicating if the data is dichotomous (e.g. boolean).
|
|
69
|
-
- `levene_flag`: A boolean flag indicating if Levene's test for homogeneity of variances is significant.
|
|
70
|
-
- `gaussian_flag`: A boolean flag indicating if the data has a Gaussian distribution.
|
|
71
99
|
|
|
72
100
|
### Generating Pretty Text Output
|
|
73
101
|
|
|
74
102
|
To get a formatted text output of your results, you can use the `utils.format_results_as_table` function.
|
|
75
103
|
|
|
76
|
-
|
|
104
|
+
Example:
|
|
77
105
|
```python
|
|
78
|
-
from abalytics
|
|
106
|
+
from abalytics.utils import format_results_as_table
|
|
107
|
+
from abalytics import analyze_independent_groups
|
|
108
|
+
import pandas as pd
|
|
79
109
|
|
|
80
|
-
#Load your data into a pandas DataFrame
|
|
110
|
+
# Load your data into a pandas DataFrame
|
|
81
111
|
df = pd.read_csv('your_data.csv')
|
|
82
112
|
|
|
83
|
-
#Analyze the results
|
|
84
|
-
analysis_results =
|
|
113
|
+
# Analyze the results
|
|
114
|
+
analysis_results = analyze_independent_groups(
|
|
85
115
|
df,
|
|
86
|
-
variable_to_analyze
|
|
87
|
-
group_column
|
|
116
|
+
variable_to_analyze="order_value",
|
|
117
|
+
group_column="ab_test_group",
|
|
88
118
|
)
|
|
89
119
|
|
|
90
|
-
#
|
|
91
|
-
pretty_text =
|
|
120
|
+
# Generate pretty text output
|
|
121
|
+
pretty_text = format_results_as_table(
|
|
92
122
|
abalytics_results=[analysis_results],
|
|
93
123
|
identifiers_list=[["A/B Test 1", "Mobile"]],
|
|
94
124
|
)
|
|
95
|
-
|
|
96
125
|
print(pretty_text)
|
|
97
126
|
```
|
|
98
127
|
Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# ABalytics: Advanced A/B Testing Statistical Analytics
|
|
2
|
+
|
|
3
|
+
ABalytics is a Python package designed for statistical analysis, particularly for assessing the significance of A/B testing results. Its goal is to provide high-quality analysis by selecting the appropriate statistical tests based on the type of variable being analyzed. It offers a suite of tools to perform various significance tests and posthoc analyses on experimental data.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Boolean and Numeric Analysis**: Supports analysis of both boolean and numeric data types, ensuring the use of correct statistical methods for each.
|
|
8
|
+
- **Significance Tests**: Includes a variety of significance tests such as Chi-Square, Welch's ANOVA, and Kruskal-Wallis, to accurately determine the significance of results.
|
|
9
|
+
- **Posthoc Analysis**: Offers posthoc analysis methods like Tukey's HSD, Dunn's test, and Games-Howell, for detailed examination following significance tests.
|
|
10
|
+
- **Normality and Homogeneity Checks**: Performs checks for Gaussian distribution and homogeneity of variances using Levene's test, which are critical for selecting the right tests.
|
|
11
|
+
- **Data Transformation**: Provides functionality to convert data from long to wide format, facilitating analysis of dependent groups.
|
|
12
|
+
- **Pretty Text Output**: Generates a formatted text output with the results of the statistical tests, facilitating interpretation and reporting.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
To install ABalytics, use pip:
|
|
17
|
+
```bash
|
|
18
|
+
pip install abalytics
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
### Analyzing Results
|
|
23
|
+
|
|
24
|
+
ABalytics provides two main functions for analyzing A/B testing results: `analyze_independent_groups` and `analyze_dependent_groups`.
|
|
25
|
+
|
|
26
|
+
#### Independent Groups Analysis
|
|
27
|
+
|
|
28
|
+
`analyze_independent_groups` is used for analyzing data where the groups are independent of each other. It takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and optional parameters for p-value threshold and minimum sample size.
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
```python
|
|
32
|
+
from abalytics import analyze_independent_groups
|
|
33
|
+
import pandas as pd
|
|
34
|
+
|
|
35
|
+
# Load your data into a pandas DataFrame
|
|
36
|
+
df = pd.read_csv('your_data.csv')
|
|
37
|
+
|
|
38
|
+
# Analyze the results
|
|
39
|
+
analysis_results = analyze_independent_groups(
|
|
40
|
+
df,
|
|
41
|
+
variable_to_analyze="order_value",
|
|
42
|
+
group_column="ab_test_group",
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#### Dependent Groups Analysis
|
|
48
|
+
|
|
49
|
+
`analyze_dependent_groups` is used for analyzing data where the groups are dependent, such as repeated measures on the same subjects. It requires data in wide format. If your data is in long format, you can use the `convert_long_to_wide` function in `abalytics.utils` to convert it. The `analyze_dependent_groups` function takes a pandas DataFrame, the names of the columns to compare, and optional parameters for p-value threshold and minimum sample size.
|
|
50
|
+
|
|
51
|
+
Example:
|
|
52
|
+
```python
|
|
53
|
+
from abalytics import analyze_dependent_groups
|
|
54
|
+
import pandas as pd
|
|
55
|
+
|
|
56
|
+
# Load your data into a pandas DataFrame
|
|
57
|
+
df = pd.read_csv('your_data.csv')
|
|
58
|
+
|
|
59
|
+
# Analyze the results
|
|
60
|
+
analysis_results = analyze_dependent_groups(
|
|
61
|
+
df,
|
|
62
|
+
variables_to_compare=["pre_test_score", "post_test_score"],
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Data Transformation
|
|
67
|
+
|
|
68
|
+
The `convert_long_to_wide` function in `abalytics.utils` is designed to transform data from long format to wide format, with an option to keep multi-level columns or flatten them. `analyze_dependent_groups` requires data in wide format to operate correctly.
|
|
69
|
+
|
|
70
|
+
Example:
|
|
71
|
+
```python
|
|
72
|
+
from abalytics.utils import convert_long_to_wide
|
|
73
|
+
import pandas as pd
|
|
74
|
+
|
|
75
|
+
# Assuming 'df_long' is your pandas DataFrame in long format
|
|
76
|
+
df_wide = convert_long_to_wide(
|
|
77
|
+
df_long,
|
|
78
|
+
index_col="subject_id",
|
|
79
|
+
columns_col="condition",
|
|
80
|
+
flatten_columns=True # Set to False if you wish to keep multi-level columns
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Generating Pretty Text Output
|
|
85
|
+
|
|
86
|
+
To get a formatted text output of your results, you can use the `utils.format_results_as_table` function.
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
```python
|
|
90
|
+
from abalytics.utils import format_results_as_table
|
|
91
|
+
from abalytics import analyze_independent_groups
|
|
92
|
+
import pandas as pd
|
|
93
|
+
|
|
94
|
+
# Load your data into a pandas DataFrame
|
|
95
|
+
df = pd.read_csv('your_data.csv')
|
|
96
|
+
|
|
97
|
+
# Analyze the results
|
|
98
|
+
analysis_results = analyze_independent_groups(
|
|
99
|
+
df,
|
|
100
|
+
variable_to_analyze="order_value",
|
|
101
|
+
group_column="ab_test_group",
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# Generate pretty text output
|
|
105
|
+
pretty_text = format_results_as_table(
|
|
106
|
+
abalytics_results=[analysis_results],
|
|
107
|
+
identifiers_list=[["A/B Test 1", "Mobile"]],
|
|
108
|
+
)
|
|
109
|
+
print(pretty_text)
|
|
110
|
+
```
|
|
111
|
+
Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
|
|
112
|
+
|
|
113
|
+
A further example of how to use ABalytics can be found in `examples/example.py`.
|
|
114
|
+
|
|
115
|
+
## Contributing
|
|
116
|
+
|
|
117
|
+
Contributions to ABalytics are welcome. If you have suggestions for improvements or find any issues, please open an issue or submit a pull request.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .significance_tests import PosthocResults
|
|
2
2
|
from typing import Optional, List
|
|
3
|
+
import pandas as pd
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
def get_table_header(max_identifier_length) -> str:
|
|
@@ -96,3 +97,29 @@ def format_results_as_table(
|
|
|
96
97
|
)
|
|
97
98
|
output_string += "\n".join(output_results)
|
|
98
99
|
return output_string
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def convert_long_to_wide(
|
|
103
|
+
df: pd.DataFrame, index_col: str, columns_col: str, flatten_columns: bool = True
|
|
104
|
+
) -> pd.DataFrame:
|
|
105
|
+
"""
|
|
106
|
+
Converts a DataFrame from long format to wide format, turning all columns into 'column_group' format.
|
|
107
|
+
Optionally flattens multi-level columns into single-level.
|
|
108
|
+
|
|
109
|
+
Parameters:
|
|
110
|
+
df (pd.DataFrame): The DataFrame in long format.
|
|
111
|
+
index_col (str): The name of the column to use as the identifier (index) in the wide format.
|
|
112
|
+
columns_col (str): The name of the column that contains the group names in the long format.
|
|
113
|
+
flatten_columns (bool, optional): Whether to flatten multi-level columns into single-level. Defaults to True.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
pd.DataFrame: The DataFrame converted to wide format, with optional column flattening.
|
|
117
|
+
"""
|
|
118
|
+
# Create a pivot table with multi-level columns
|
|
119
|
+
wide_df = df.pivot_table(index=index_col, columns=columns_col, aggfunc='first')
|
|
120
|
+
|
|
121
|
+
if flatten_columns:
|
|
122
|
+
# Flatten the multi-level columns and create combined column names
|
|
123
|
+
wide_df.columns = ["{}_{}".format(col[0], col[1]) for col in wide_df.columns.values]
|
|
124
|
+
|
|
125
|
+
return wide_df.reset_index()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: abalytics
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Advanced A/B Testing Statistical Analytics
|
|
5
5
|
Author: Janis Berneker
|
|
6
6
|
License: LICENSE
|
|
@@ -24,6 +24,7 @@ ABalytics is a Python package designed for statistical analysis, particularly fo
|
|
|
24
24
|
- **Significance Tests**: Includes a variety of significance tests such as Chi-Square, Welch's ANOVA, and Kruskal-Wallis, to accurately determine the significance of results.
|
|
25
25
|
- **Posthoc Analysis**: Offers posthoc analysis methods like Tukey's HSD, Dunn's test, and Games-Howell, for detailed examination following significance tests.
|
|
26
26
|
- **Normality and Homogeneity Checks**: Performs checks for Gaussian distribution and homogeneity of variances using Levene's test, which are critical for selecting the right tests.
|
|
27
|
+
- **Data Transformation**: Provides functionality to convert data from long to wide format, facilitating analysis of dependent groups.
|
|
27
28
|
- **Pretty Text Output**: Generates a formatted text output with the results of the statistical tests, facilitating interpretation and reporting.
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
@@ -34,65 +35,93 @@ pip install abalytics
|
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
## Usage
|
|
38
|
+
### Analyzing Results
|
|
39
|
+
|
|
40
|
+
ABalytics provides two main functions for analyzing A/B testing results: `analyze_independent_groups` and `analyze_dependent_groups`.
|
|
41
|
+
|
|
42
|
+
#### Independent Groups Analysis
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
`analyze_independent_groups` is used for analyzing data where the groups are independent of each other. It takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and optional parameters for p-value threshold and minimum sample size.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
39
47
|
```python
|
|
40
|
-
import
|
|
48
|
+
from abalytics import analyze_independent_groups
|
|
49
|
+
import pandas as pd
|
|
50
|
+
|
|
51
|
+
# Load your data into a pandas DataFrame
|
|
52
|
+
df = pd.read_csv('your_data.csv')
|
|
53
|
+
|
|
54
|
+
# Analyze the results
|
|
55
|
+
analysis_results = analyze_independent_groups(
|
|
56
|
+
df,
|
|
57
|
+
variable_to_analyze="order_value",
|
|
58
|
+
group_column="ab_test_group",
|
|
59
|
+
)
|
|
41
60
|
```
|
|
42
61
|
|
|
43
|
-
### Analyzing Results
|
|
44
62
|
|
|
45
|
-
|
|
46
|
-
`analyze_independent_groups` takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
47
|
-
`analyze_dependent_groups` takes a pandas DataFrame, the names of the columns to compare, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
63
|
+
#### Dependent Groups Analysis
|
|
48
64
|
|
|
49
|
-
|
|
65
|
+
`analyze_dependent_groups` is used for analyzing data where the groups are dependent, such as repeated measures on the same subjects. It requires data in wide format. If your data is in long format, you can use the `convert_long_to_wide` function in `abalytics.utils` to convert it. The `analyze_dependent_groups` function takes a pandas DataFrame, the names of the columns to compare, and optional parameters for p-value threshold and minimum sample size.
|
|
66
|
+
|
|
67
|
+
Example:
|
|
50
68
|
```python
|
|
51
|
-
import
|
|
69
|
+
from abalytics import analyze_dependent_groups
|
|
52
70
|
import pandas as pd
|
|
53
71
|
|
|
54
|
-
#Load your data into a pandas DataFrame
|
|
72
|
+
# Load your data into a pandas DataFrame
|
|
55
73
|
df = pd.read_csv('your_data.csv')
|
|
56
74
|
|
|
57
|
-
#Analyze the results
|
|
58
|
-
analysis_results =
|
|
75
|
+
# Analyze the results
|
|
76
|
+
analysis_results = analyze_dependent_groups(
|
|
59
77
|
df,
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
variables_to_compare=["pre_test_score", "post_test_score"],
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Data Transformation
|
|
83
|
+
|
|
84
|
+
The `convert_long_to_wide` function in `abalytics.utils` is designed to transform data from long format to wide format, with an option to keep multi-level columns or flatten them. `analyze_dependent_groups` requires data in wide format to operate correctly.
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
```python
|
|
88
|
+
from abalytics.utils import convert_long_to_wide
|
|
89
|
+
import pandas as pd
|
|
90
|
+
|
|
91
|
+
# Assuming 'df_long' is your pandas DataFrame in long format
|
|
92
|
+
df_wide = convert_long_to_wide(
|
|
93
|
+
df_long,
|
|
94
|
+
index_col="subject_id",
|
|
95
|
+
columns_col="condition",
|
|
96
|
+
flatten_columns=True # Set to False if you wish to keep multi-level columns
|
|
62
97
|
)
|
|
63
98
|
```
|
|
64
|
-
The `get_results` function will return an `AnalysisResults` object containing the following attributes:
|
|
65
|
-
- `significant_results`: A list of results of the statistical significance tests.
|
|
66
|
-
- `info`: A string containing information about the data if no results were found.
|
|
67
|
-
- `sample_size`: The sample size of the data.
|
|
68
|
-
- `dichotomous_flag`: A boolean flag indicating if the data is dichotomous (e.g. boolean).
|
|
69
|
-
- `levene_flag`: A boolean flag indicating if Levene's test for homogeneity of variances is significant.
|
|
70
|
-
- `gaussian_flag`: A boolean flag indicating if the data has a Gaussian distribution.
|
|
71
99
|
|
|
72
100
|
### Generating Pretty Text Output
|
|
73
101
|
|
|
74
102
|
To get a formatted text output of your results, you can use the `utils.format_results_as_table` function.
|
|
75
103
|
|
|
76
|
-
|
|
104
|
+
Example:
|
|
77
105
|
```python
|
|
78
|
-
from abalytics
|
|
106
|
+
from abalytics.utils import format_results_as_table
|
|
107
|
+
from abalytics import analyze_independent_groups
|
|
108
|
+
import pandas as pd
|
|
79
109
|
|
|
80
|
-
#Load your data into a pandas DataFrame
|
|
110
|
+
# Load your data into a pandas DataFrame
|
|
81
111
|
df = pd.read_csv('your_data.csv')
|
|
82
112
|
|
|
83
|
-
#Analyze the results
|
|
84
|
-
analysis_results =
|
|
113
|
+
# Analyze the results
|
|
114
|
+
analysis_results = analyze_independent_groups(
|
|
85
115
|
df,
|
|
86
|
-
variable_to_analyze
|
|
87
|
-
group_column
|
|
116
|
+
variable_to_analyze="order_value",
|
|
117
|
+
group_column="ab_test_group",
|
|
88
118
|
)
|
|
89
119
|
|
|
90
|
-
#
|
|
91
|
-
pretty_text =
|
|
120
|
+
# Generate pretty text output
|
|
121
|
+
pretty_text = format_results_as_table(
|
|
92
122
|
abalytics_results=[analysis_results],
|
|
93
123
|
identifiers_list=[["A/B Test 1", "Mobile"]],
|
|
94
124
|
)
|
|
95
|
-
|
|
96
125
|
print(pretty_text)
|
|
97
126
|
```
|
|
98
127
|
Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
|
abalytics-2.0.0/README.md
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# ABalytics: Advanced A/B Testing Statistical Analytics
|
|
2
|
-
|
|
3
|
-
ABalytics is a Python package designed for statistical analysis, particularly for assessing the significance of A/B testing results. Its goal is to provide high-quality analysis by selecting the appropriate statistical tests based on the type of variable being analyzed. It offers a suite of tools to perform various significance tests and posthoc analyses on experimental data.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Boolean and Numeric Analysis**: Supports analysis of both boolean and numeric data types, ensuring the use of correct statistical methods for each.
|
|
8
|
-
- **Significance Tests**: Includes a variety of significance tests such as Chi-Square, Welch's ANOVA, and Kruskal-Wallis, to accurately determine the significance of results.
|
|
9
|
-
- **Posthoc Analysis**: Offers posthoc analysis methods like Tukey's HSD, Dunn's test, and Games-Howell, for detailed examination following significance tests.
|
|
10
|
-
- **Normality and Homogeneity Checks**: Performs checks for Gaussian distribution and homogeneity of variances using Levene's test, which are critical for selecting the right tests.
|
|
11
|
-
- **Pretty Text Output**: Generates a formatted text output with the results of the statistical tests, facilitating interpretation and reporting.
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
To install ABalytics, use pip:
|
|
16
|
-
```bash
|
|
17
|
-
pip install abalytics
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
To use ABalytics, import it:
|
|
23
|
-
```python
|
|
24
|
-
import abalytics
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Analyzing Results
|
|
28
|
-
|
|
29
|
-
To analyze your A/B testing results, you can use the two functions.
|
|
30
|
-
`analyze_independent_groups` takes a pandas DataFrame, the name of the column containing the variable to analyze, the name of the column containing the grouping variable, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
31
|
-
`analyze_dependent_groups` takes a pandas DataFrame, the names of the columns to compare, and an optional p-value threshold (default is 0.05) and min_sample_size (default is 25).
|
|
32
|
-
|
|
33
|
-
Here's an example of how to use `analyze_independent_groups`:
|
|
34
|
-
```python
|
|
35
|
-
import abalytics
|
|
36
|
-
import pandas as pd
|
|
37
|
-
|
|
38
|
-
#Load your data into a pandas DataFrame
|
|
39
|
-
df = pd.read_csv('your_data.csv')
|
|
40
|
-
|
|
41
|
-
#Analyze the results
|
|
42
|
-
analysis_results = abalytics.analyze_independent_groups(
|
|
43
|
-
df,
|
|
44
|
-
variable_to_analyze = "order_value",
|
|
45
|
-
group_column = "ab_test_group",
|
|
46
|
-
)
|
|
47
|
-
```
|
|
48
|
-
The `get_results` function will return an `AnalysisResults` object containing the following attributes:
|
|
49
|
-
- `significant_results`: A list of results of the statistical significance tests.
|
|
50
|
-
- `info`: A string containing information about the data if no results were found.
|
|
51
|
-
- `sample_size`: The sample size of the data.
|
|
52
|
-
- `dichotomous_flag`: A boolean flag indicating if the data is dichotomous (e.g. boolean).
|
|
53
|
-
- `levene_flag`: A boolean flag indicating if Levene's test for homogeneity of variances is significant.
|
|
54
|
-
- `gaussian_flag`: A boolean flag indicating if the data has a Gaussian distribution.
|
|
55
|
-
|
|
56
|
-
### Generating Pretty Text Output
|
|
57
|
-
|
|
58
|
-
To get a formatted text output of your results, you can use the `utils.format_results_as_table` function.
|
|
59
|
-
|
|
60
|
-
Here's an example of how to use format_results_as_table`:
|
|
61
|
-
```python
|
|
62
|
-
from abalytics
|
|
63
|
-
|
|
64
|
-
#Load your data into a pandas DataFrame
|
|
65
|
-
df = pd.read_csv('your_data.csv')
|
|
66
|
-
|
|
67
|
-
#Analyze the results
|
|
68
|
-
analysis_results = abalytics.analyze_independent_groups(
|
|
69
|
-
df,
|
|
70
|
-
variable_to_analyze = "order_value",
|
|
71
|
-
group_column = "ab_test_group",
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
# Assuming 'df' is your pandas DataFrame
|
|
75
|
-
pretty_text = abalytics.utils.format_results_as_table(
|
|
76
|
-
abalytics_results=[analysis_results],
|
|
77
|
-
identifiers_list=[["A/B Test 1", "Mobile"]],
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
print(pretty_text)
|
|
81
|
-
```
|
|
82
|
-
Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
|
|
83
|
-
|
|
84
|
-
A further example of how to use ABalytics can be found in `examples/example.py`.
|
|
85
|
-
|
|
86
|
-
## Contributing
|
|
87
|
-
|
|
88
|
-
Contributions to ABalytics are welcome. If you have suggestions for improvements or find any issues, please open an issue or submit a pull request.
|
|
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
|