This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://upload.wikimedia.org/wikipedia/commons/c/c5/%21%21%21_Mdina_buildings_05.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/d/d5/%21-2011-debowa-leka-palac-abri.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/c/c2/%21-20100523-szlichtyngowa-wiatrak-abri.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/c/ca/%21Illegal_street_ads_on_a_bicycle.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/f/fc/%21-2010-hetmanice-kosciol-abri.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/2/27/%21-2011-debowa-leka-kosciol-abri.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/0/0b/%22%2Barya%2B%22_penjual_jamu_tradisional_-_%EA%A6%A2%EA%A6%BA%EA%A6%B4%EA%A6%AD%EA%A7%80%EA%A6%A2%EA%A6%BA%EA%A6%B4%EA%A6%AD%EA%A6%A4%EA%A7%80_%EA%A6%97%EA%A6%A9%EA%A6%B8_%EA%A6%A0%EA%A6%BF%EA%A6%A2%EA%A6%B6%EA%A6%B1%EA%A6%B6%EA%A6%AA%EA%A6%BA%EA%A6%B4%EA%A6%A4%EA%A6%AD%EA%A7%80_Pilangsari_2019.jpg | |
| https://upload.wikimedia.org/wikipedia/commons/c/cd/%22..._Although_a_dress_uniform_is_not_a_part_of_the_regular_equipment%2C_most_of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import numpy as np | |
| from statsmodels.stats.proportion import score_test_proportions_2indep | |
| from scipy import stats | |
| from numba import njit, prange | |
| import matplotlib.pyplot as plt | |
| import matplotlib.ticker as ticker | |
| import seaborn as sns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rng = np.random.default_rng(1337) # random number generator using the one true seed | |
| sns.set_style('white') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NUM_CONTROL_USERS = 6 # total number of users in control group | |
| control_users = np.zeros(NUM_CONTROL_USERS) | |
| #> array([0., 0., 0., 0., 0., 0.]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NUM_CONVERTING_CONTROL_USERS = 3 | |
| control_users[:NUM_CONVERTING_CONTROL_USERS] = 1.0 | |
| #> array([1., 1., 1., 0., 0., 0.]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| control_conversion_rate = control_users.mean() | |
| print(f"control conversion rate: {control_conversion_rate:.1%}") | |
| #> control conversion rate: 50.0% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NUM_VARIANT_USERS = 6 | |
| NUM_CONVERTING_VARIANT_USERS = 4 | |
| variant_users = np.zeros(NUM_VARIANT_USERS) | |
| variant_users[:NUM_CONVERTING_VARIANT_USERS] = 1.0 | |
| variant_conversion_rate = variant_users.mean() | |
| print(f"variant conversion rate: {variant_conversion_rate:.1%}") | |
| #> variant conversion rate: 66.7% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| observed_diff_in_rates = variant_conversion_rate - control_conversion_rate | |
| print(f"observed difference in conversion rates: {observed_diff_in_rates:.1%}") | |
| #> observed difference in conversion rates: 16.7% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| all_users = np.hstack([control_users, variant_users]) | |
| #> array([1., 1., 1., 0., 0., 0., 1., 1., 1., 1., 0., 0.]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rng.shuffle(all_users) | |
| #> array([0., 1., 1., 0., 1., 1., 1., 0., 0., 0., 1., 1.]) |