Vivian
3/26/2020 - 9:12 AM

t-test

# t-test on two groups
from scipy import stats

a = df4a[df4a['group']=='x_user']['n_lms_dl']
b = df4a[df4a['group']=='x_tryer']['n_lms_dl']
t, p = stats.ttest_ind(a = a, b = b, equal_var=False)
print("ttest_ind: t = %g  p = %g" % (t, p))

# t-test on two proportions of two groups
from statsmodels.stats.proportion import proportions_ztest

stat, pval = proportions_ztest([converted_count_a, converted_count_b], [n_a, n_b], alternative='two-sided')
print('p-value: {0:0.3f}'.format(pval))