Created
May 15, 2023 22:55
-
-
Save eustin/972049a1ff2bb807c5cf6e194d965693 to your computer and use it in GitHub Desktop.
stat_sig_random_15
This file contains 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
@njit(parallel=True) | |
def sample_diffs_in_rates(all_users, num_control_users, num_simulations): | |
results = np.zeros(num_simulations) | |
for i in prange(num_simulations): | |
# numpy random shuffling appears to be slower when using numba | |
random.shuffle(all_users) | |
control_rate = all_users[:num_control_users].mean() | |
# we assume the rest of the users are variant users | |
variant_rate = all_users[num_control_users:].mean() | |
results[i] = variant_rate - control_rate | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment