Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Second Levene's Test | Variances in A/B Testing
The Art of A/B Testing

book
Challenge: Second Levene's Test

Tâche

Swipe to start coding

This task is related to the previous task. As you remember from the graphs for the 'Earning' columns, you might think that the variances are different. Is it really so?

  1. Import levene test.
  2. Do the Levene's test.

Solution

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

# 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=';')

# Do Levene's test
statistic, p_value = levene(df_control['Earning'], df_test['Earning'])

# Print result of Levene's test
print('Statistic:', statistic)
print('p-value:', p_value)

# Determine whether the variances are similar
if p_value > 0.05:
print('The variances of the two groups are NOT statistically different')
else:
print('The variances of the two groups are statistically different')

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 6
# Import libraries
import pandas as pd
from ___ import ___

# 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=';')

# Do Levene's test
statistic, p_value = ___(___['Earning'], ___['Earning'])

# Print result of Levene's test
print('Statistic:', statistic)
print('p-value:', p_value)

# Determine whether the variances are similar
if p_value > 0.05:
print('The variances of the two groups are NOT statistically different')
else:
print('The variances of the two groups are statistically different')

Demandez à l'IA

expand
ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt