Correlation की सावधानियाँ

Python में Statistics परिचय

Maggie Matsui

Content Developer, DataCamp

Non-linear संबंध

द्विघात संबंध वाले वैरिएबल्स का स्कैटरप्लॉट

$$r = 0.18$$

Python में Statistics परिचय

Non-linear संबंध

हम क्या देखते हैं:

द्विघात ट्रेंडलाइन सहित द्विघात संबंध का स्कैटरप्लॉट

Correlation coefficient क्या देखता है:

लिनियर ट्रेंडलाइन सहित द्विघात संबंध का स्कैटरप्लॉट

Python में Statistics परिचय

Correlation केवल लीनियर संबंधों को पकड़ता है

Correlation पर आँख बंद कर भरोसा न करें

df['x'].corr(df['y'])
0.081094

हमेशा अपने डेटा को विज़ुअलाइज़ करें

द्विघात संबंध वाले वैरिएबल्स का स्कैटरप्लॉट

Python में Statistics परिचय

स्तनधारियों की नींद का डेटा

print(msleep)
                 name       genus   vore         order  ... sleep_cycle  awake  brainwt   bodywt
1             Cheetah    Acinonyx  carni     Carnivora  ...         NaN   11.9      NaN   50.000
2          Owl monkey       Aotus   omni      Primates  ...         NaN    7.0  0.01550    0.480
3     Mountain beaver  Aplodontia  herbi      Rodentia  ...         NaN    9.6      NaN    1.350
4 Greater short-ta...     Blarina   omni  Soricomorpha  ...    0.133333    9.1  0.00029    0.019
5                 Cow         Bos  herbi  Artiodactyla  ...    0.666667   20.0  0.42300  600.000
..                ...         ...    ...           ...  ...         ...    ...      ...      ...
79         Tree shrew      Tupaia   omni    Scandentia  ...    0.233333   15.1  0.00250    0.104
80 Bottle-nosed do...    Tursiops  carni       Cetacea  ...         NaN   18.8      NaN  173.330
81              Genet     Genetta  carni     Carnivora  ...         NaN   17.7  0.01750    2.000
82         Arctic fox      Vulpes  carni     Carnivora  ...         NaN   11.5  0.04450    3.380
83            Red fox      Vulpes  carni     Carnivora  ...    0.350000   14.2  0.05040    4.230
Python में Statistics परिचय

बॉडी वेट बनाम जागने का समय

बॉडी वेट बनाम जागने के समय का स्कैटरप्लॉट

msleep['bodywt'].corr(msleep['awake'])
0.3119801
Python में Statistics परिचय

बॉडी वेट का वितरण

bodywt वैरिएबल का हिस्टोग्राम

Python में Statistics परिचय

लॉग ट्रांसफॉर्मेशन

msleep['log_bodywt'] = np.log(msleep['bodywt'])

sns.lmplot(x='log_bodywt', y='awake', data=msleep, ci=None) plt.show()
msleep['log_bodywt'].corr(msleep['awake'])
0.5687943

लॉग bodywt बनाम awake का स्कैटरप्लॉट

Python में Statistics परिचय

अन्य ट्रांसफॉर्मेशन

  • लॉग ट्रांसफॉर्मेशन (log(x))
  • स्क्वेयर रूट ट्रांसफॉर्मेशन (sqrt(x))
  • रेसिप्रोकल ट्रांसफॉर्मेशन (1 / x)

  • इनका संयोजन, जैसे:

    • log(x) और log(y)
    • sqrt(x) और 1 / y
Python में Statistics परिचय

ट्रांसफॉर्मेशन क्यों करें?

  • कुछ सांख्यिकीय विधियाँ वैरिएबल्स के बीच लीनियर संबंध मानती हैं
    • Correlation coefficient
    • Linear regression

 

Introduction to Linear Modeling in Python

Python में Statistics परिचय

Correlation का मतलब causation नहीं है

                x का y से correlation है का मतलब यह नहीं कि x y का कारण है

US में प्रति व्यक्ति मार्जरीन खपत बनाम मेन में तलाक दर का स्कैटरप्लॉट। वैरिएबल्स में उच्च correlation है, correlation coefficient 0.99

Python में Statistics परिचय

Confounding

  कॉफी पीना (x) से फेफड़ों का कैंसर (y) की ओर संकेत

Python में Statistics परिचय

Confounding

  कॉफी पीना (x) से फेफड़ों का कैंसर (y) की ओर, ऊपर स्मोकिंग (confounder)

Python में Statistics परिचय

Confounding

  कॉफी पीना (x) से फेफड़ों का कैंसर (y) की ओर, स्मोकिंग (confounder) के साथ। स्मोकिंग और कॉफी पीने के बीच "association" लेबल वाली डबल ऐरो.

Python में Statistics परिचय

Confounding

  कॉफी पीना (x) से फेफड़ों का कैंसर (y) की ओर, स्मोकिंग (confounder) के साथ। स्मोकिंग और कॉफी पीने के बीच "association"। स्मोकिंग से फेफड़ों के कैंसर की ओर "causation"

Python में Statistics परिचय

Confounding

  कॉफी पीना (x) और फेफड़ों का कैंसर (y) के बीच "association" वाली डबल ऐरो। स्मोकिंग और कॉफी पीने के बीच "association"। स्मोकिंग से फेफड़ों के कैंसर की ओर "causation".

  Holidays (x) से रिटेल सेल्स (y) की ओर। Special deals (confounder) की डबल ऐरो holidays से और सिंगल ऐरो रिटेल सेल्स की ओर.

Python में Statistics परिचय

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

Python में Statistics परिचय

Preparing Video For Download...