Resolved: alternative hypothesis
in the alternative, how is AOV before -AOV after > 0
it should be lower if the new policy is improving the sales
Hi Doaa!
Thanks for noticing!
You are correct. We'll update the course content very soon.
Best,
Ivan
I took me quite some time to digest this part too.
I think there are a few confusing parts on the notebook 5.3. Paired Sample t-Test.ipynb, too.
FIRST:
The null hypothesis is stated as follows:
- H0: µ(AOV_Before) - µ(AOV_After) = 0 ('the mean difference in AOV between the new and old return policy is zero').
We aim to demonstrate that the new return policy results in a higher AOV. Therefore, we adopt an upper-tailed alternative hypothesis (H1) indicating a positive difference between the two population means:
- H1: µ(AOV_Before) - µ(AOV_After) < 0 ('the mean difference in AOV between the new and old return policy is less than zero').
Furthermore, we set the significance level, alpha, to 0.05.
->
NOTE: If H1: µ(AOV_Before) - µ(AOV_After) < 0, shouldn't it mean we use lower-tailed test?
If we opted for upper-tailed test, shouldn't it be :
H0: µ(AOV_After) - µ(AOV_Before) = 0
H1: µ(AOV_After) - µ(AOV_Before) > 0
Which also more coherent with the code in the notebook:
ttest_rel(data_after, data_before, alternative= "greater")
-------------------------------
-------------------------------
SECOND:
The **scipy.stats.ttest_rel()** function in SciPy is utilized to execute the paired samples t-test—also known as the dependent or related t-test. This test assesses whether there's a significant difference between the means of two paired or dependent samples.
...
- **'greater'** checks if the mean of the first sample (a) is greater than that of the second sample (b), implying a positive mean difference. For our hypothesis, 'less' should be selected since we assert that the post-policy mean is greater (therefore, the mean difference is negative).
Note: again, greater or less?
if we want to use 'less' the code should be:
ttest_rel(data_before, data_after, alternative= "less")
right?
CMIIW
Hi David,
Thank you for spotting this mistake. You are right.
The alternative should be as follows:
H1: µ(AOV_After) - µ(AOV_Before) > 0
respectively
H1: µ(AOV_Before) - µ(AOV_After) < 0
Accordingly the relevant line of code should be:
ttest_rel(data_after, data_before, alternative= "greater")
respectively:
ttest_rel(data_before, data_after, alternative= "less")