Autocorrelation Function

Python में Time Series Analysis

Rob Reider

Adjunct Professor, NYU-Courant Consultant, Quantopian

Autocorrelation Function

  • Autocorrelation Function (ACF): lag के हिसाब से autocorrelation
  • lag-zero पर मान एक होता है
  • lag-one से आगे की जानकारी उपयोगी है
Python में Time Series Analysis

ACF उदाहरण 1: साधारण Autocorrelation Function

  • पूर्वानुमान के लिए series के पिछली दो वैल्यूज़ उपयोग करें
Python में Time Series Analysis

ACF उदाहरण 2: मौसमी Earnings

  • H&R Block की earnings
  • H&R Block की ACF
Python में Time Series Analysis

ACF उदाहरण 3: मॉडल चयन में सहायक

  • मॉडल चयन

Python में Time Series Analysis

Python में ACF प्लॉट करें

  • मॉड्यूल इम्पोर्ट करें:
    from statsmodels.graphics.tsaplots import plot_acf
    
  • ACF प्लॉट करें:
    plot_acf(x, lags= 20, alpha=0.05)
    
Python में Time Series Analysis

ACF का Confidence Interval

Python में Time Series Analysis

ACF का Confidence Interval

  • आर्ग्युमेंट alpha से confidence interval की चौड़ाई सेट होती है
  • उदाहरण: alpha=0.05
    • 5% संभावना कि यदि true autocorrelation zero है, तो वह नीले बैंड के बाहर होगा
  • Confidence bands चौड़े होते हैं जब:
    • Alpha कम हो
    • Observations कम हों
  • कुछ सरल मान्यताओं में, 95% confidence bands $\pm 2/\sqrt{N}$ होते हैं
  • यदि प्लॉट पर bands नहीं चाहिए, तो alpha=1 सेट करें
Python में Time Series Analysis

प्लॉट की जगह ACF वैल्यूज़

from statsmodels.tsa.stattools import acf
print(acf(x))
[ 1.         -0.6765505   0.34989905 -0.01629415 -0.02507013  0.01930354
 -0.03186545  0.01399904 -0.03518128  0.02063168 -0.02620646 -0.00509828
...
  0.07191516 -0.12211912  0.14514481 -0.09644228  0.05215882]
Python में Time Series Analysis

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

Python में Time Series Analysis

Preparing Video For Download...