Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Second T-test | T-Test
The Art of A/B Testing

book
Challenge: Second T-test

Завдання

Swipe to start coding

Your task is to do a t-test. Recall that the distribution in the 'Click' column has a normal distribution in both datasets. Also, there is a statistically significant difference between the variances. Now it is time to find out whether there is statistical evidence that the means of the two samples are equal.

Remember this: We are not doing the usual T-test here, but a modification of the Welch T-test. For samples with different variances, you need to specify an additional parameter equal_var=False in the ttest_ind() function. This will lead to the use of a modification of the Welch T-test, which is designed to work with samples with different variances.

  1. Calculate the mean values.
  2. Do a T-Test.

Рішення

# Import libraries
import pandas as pd
from scipy.stats import ttest_ind

# Read .csv files
df_control = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_control.csv', delimiter=';')
df_test = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_test.csv', delimiter=';')

# Select only the 'Click' columns
data_control = df_control['Click']
data_test = df_test['Click']

# Calculate the mean values
print('The mean of control group = ', data_control.mean())
print('The mean of test group = ', data_test.mean())

# Do T-Test
statistic, p_value = ttest_ind(data_control, data_test, equal_var=False)

# Print the result of T-Test
print('Statistic:', statistic)
print('p-value:', p_value)

# Determine whether there is a statistically significant difference between the means of the two samples
if p_value > 0.05:
print('The means of the two groups are NOT statistically different')
else:
print('The means of the two groups are statistically different')

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 3
single

single

# Import libraries
import pandas as pd
from scipy.stats import ttest_ind

# Read .csv files
df_control = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_control.csv', delimiter=';')
df_test = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c3b98ad3-420d-403f-908d-6ab8facc3e28/ab_test.csv', delimiter=';')

# Select only the 'Click' columns
data_control = df_control['Click']
data_test = df_test['Click']

# Calculate the mean values
print('The mean of control group = ', data_control.___)
print('The mean of test group = ', data_test.___)

# Do T-Test
statistic, p_value = ___(data_control, data_test, equal_var=False)

# Print the result of T-Test
print('Statistic:', statistic)
print('p-value:', p_value)

# Determine whether there is a statistically significant difference between the means of the two samples
if p_value > 0.05:
print('The means of the two groups are NOT statistically different')
else:
print('The means of the two groups are statistically different')

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt