Hypothesis tests and z-scores

Python में Hypothesis Testing

James Chapman

Curriculum Manager, DataCamp

A/B testing

  • 2013 में Electronic Arts (EA) ने SimCity 5 रिलीज़ किया
  • वे गेम के प्री-ऑर्डर बढ़ाना चाहते थे
  • उन्होंने अलग-अलग विज्ञापन परिदृश्यों को जाँचने के लिए A/B testing का उपयोग किया
  • इसमें उपयोगकर्ताओं को control और treatment समूहों में बाँटना होता है

Electronic Arts की इमारत

1 छवि क्रेडिट: "Electronic Arts" by majaX1 CC BY-NC-SA 2.0
Python में Hypothesis Testing

रिटेल वेबपेज A/B टेस्ट

Control:

SimCity वेबपेज, बैनर के साथ जिस पर लिखा है "pre-order and get $20 off your next purchase"

Treatment:

बैनर के बिना SimCity वेबपेज

Python में Hypothesis Testing

A/B टेस्ट के नतीजे

  • Treatment समूह (कोई विज्ञापन नहीं) में control समूह (विज्ञापन के साथ) से 43.4% अधिक ख़रीदारी हुई
  • यह अंतर्ज्ञान कि "विज्ञापन दिखाने से बिक्री बढ़ेगी" गलत निकला
  • क्या यह परिणाम सांख्यिकीय रूप से महत्वपूर्ण था या सिर्फ संयोग?
  • यह तय करने के लिए EA का डेटा चाहिए
  • ऐसा करने के लिए Sampling in Python + इस कोर्स की तकनीकें उपयोग करें
Python में Hypothesis Testing

Stack Overflow Developer Survey 2020

import pandas as pd
print(stack_overflow)
      respondent  age_1st_code  ...   age  hobbyist
0           36.0          30.0  ...  34.0       Yes
1           47.0          10.0  ...  53.0       Yes
2           69.0          12.0  ...  25.0       Yes
3          125.0          30.0  ...  41.0       Yes
4          147.0          15.0  ...  28.0        No
...          ...           ...  ...   ...       ...
2259     62867.0          13.0  ...  33.0       Yes
2260     62882.0          13.0  ...  28.0       Yes

[2261 rows x 8 columns]
Python में Hypothesis Testing

औसत पर परिकल्पना बनाना

एक परिकल्पना:

डेटा वैज्ञानिकों की जनसंख्या का औसत वार्षिक प्रतिफल $110,000 है

बिंदु अनुमान (सैंपल सांख्यिकी):

mean_comp_samp = stack_overflow['converted_comp'].mean()
119574.71738168952
Python में Hypothesis Testing

Bootstrap वितरण जनरेट करना

import numpy as np

# चरण 3. चरण 1 और 2 को कई बार दोहराएँ और सूची में जोड़ें so_boot_distn = [] for i in range(5000): so_boot_distn.append(
# चरण 2. बिंदु अनुमान निकालें np.mean(
# चरण 1. पुन: सैंपलिंग stack_overflow.sample(frac=1, replace=True)['converted_comp']
)
)
1 Bootstrap वितरण Chapter 4 (Sampling in Python) में सिखाया गया है
Python में Hypothesis Testing

Bootstrap वितरण का विज़ुअलाइज़ेशन

import matplotlib.pyplot as plt
plt.hist(so_boot_distn, bins=50)
plt.show()

Bootstrap वितरण का हिस्टोग्राम - घंटी आकार का है और लगभग 110000 से 140000 के बीच है

Python में Hypothesis Testing

Standard error

std_error = np.std(so_boot_distn, ddof=1)
5607.997577378606
Python में Hypothesis Testing

z-scores

$\text{standardized value} = \dfrac{\text{value} - \text{mean}}{\text{standard deviation}}$

$z = \dfrac{\text{sample stat} - \text{hypoth. param. value}}{\text{standard error}}$

Python में Hypothesis Testing

$z = \dfrac{\text{sample stat} - \text{hypoth. param. value}}{\text{standard error}}$

stack_overflow['converted_comp'].mean()
119574.71738168952
mean_comp_hyp = 110000
std_error
5607.997577378606
z_score = (mean_comp_samp - mean_comp_hyp) / std_error
1.7073326529796957
Python में Hypothesis Testing

परिकल्पना की जाँच

  • 1.707 बड़ा है या छोटा?
  • यही इस कोर्स का लक्ष्य है!
Python में Hypothesis Testing

परिकल्पना की जाँच

  • 1.707 बड़ा है या छोटा?
  • यही इस कोर्स का लक्ष्य है!

 

Hypothesis testing उपयोग का मामला:

 

तय करें कि सैंपल सांख्यिकी अपेक्षित (या "hypothesized" मानों) के पास हैं या दूर

Python में Hypothesis Testing

Standard normal (z) distribution

Standard normal distribution: normal distribution जिसमें mean = 0 और standard deviation = 1 होता है

Standard normal distribution के PDF का डेंसिटी प्लॉट

Python में Hypothesis Testing

अभ्यास करते हैं!

Python में Hypothesis Testing

Preparing Video For Download...