टैक्स सीजन के दौरान Seasonal Adjustment
कई time series में मज़बूत मौसमी व्यवहार होता है। किसी time series के मौसमी घटक को हटाने की प्रक्रिया को seasonal adjustment कहा जाता है। उदाहरण के लिए, अधिकांश सरकारी रूप से प्रकाशित आर्थिक डेटा seasonally adjusted होता है।
आपने पहले देखा कि किसी random walk की first differences लेने पर एक stationary white noise process मिलता है। Seasonal adjustments के लिए, first differences की जगह, आप periodicity के अनुरूप lag के साथ differences लेते हैं।
H&R Block की तिमाही कमाई के ACF को फिर से देखें, जो DataFrame HRB में प्रीलोडेड है, और एक स्पष्ट मौसमी घटक दिखता है। Autocorrelation lags 4, 8, 12, 16, … पर अधिक है क्योंकि टैक्स सीजन में हर चार तिमाहियों पर कमाई में spike आता है। एक seasonal adjustment लागू करें: चौथा difference लें (चार इस series की periodicity दर्शाता है)। फिर transformed series का autocorrelation निकालें।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Time Series Analysis
अभ्यास निर्देश
.diff()मेथड का उपयोग करके तिमाही कमाई का lag-4 difference लें और seasonally adjusted earnings का एक नया DataFrame बनाएँ।- Seasonally adjusted DataFrame की पहली 10 पंक्तियाँ देखें और ध्यान दें कि पहली चार पंक्तियाँ
NaNहैं। .dropna()मेथड का उपयोग करकेNaNपंक्तियाँ हटा दें।- Seasonally adjusted DataFrame की autocorrelation function प्लॉट करें।
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import the plot_acf module from statsmodels
from statsmodels.graphics.tsaplots import plot_acf
# Seasonally adjust quarterly earnings
HRBsa = ___
# Print the first 10 rows of the seasonally adjusted series
print(HRBsa.___)
# Drop the NaN data in the first four rows
HRBsa = ___
# Plot the autocorrelation function of the seasonally adjusted series
plot_acf(HRBsa)
plt.show()