AR मॉडल की तुलना Random Walk से करें
कभी-कभी थोड़ा-सा मीन-रिवर्टिंग टाइम सीरीज़ और बिल्कुल भी मीन-रिवर्ट न करने वाली टाइम सीरीज़, जैसे कि रैंडम वॉक, में फर्क करना मुश्किल होता है। आप पिछले अभ्यास की थोड़ी-सी मीन-रिवर्टिंग ब्याज दर सीरीज़ की ACF की तुलना उतनी ही ऑब्ज़र्वेशंस वाले सिम्यूलेटेड रैंडम वॉक से करेंगे.
जब आप इन दोनों सीरीज़ की ऑटोकॉरिलेशन को साथ-साथ प्लॉट करेंगे, तो आप देखेंगे कि वे काफ़ी मिलती-जुलती लगती हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Time Series Analysis
अभ्यास निर्देश
statsmodelsमॉड्यूल सेplot_acfफंक्शन इम्पोर्ट करें- दो सबप्लॉट्स के लिए दो axes बनाएँ
- टॉप प्लॉट में ब्याज दर सीरीज़
interest_rate_dataके 12 लैग्स का ऑटोकॉरिलेशन फंक्शन प्लॉट करें - बॉटम प्लॉट में सीरीज़
simulated_dataके 12 लैग्स का ऑटोकॉरिलेशन फंक्शन प्लॉट करें
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import the plot_acf module from statsmodels
from statsmodels.graphics.tsaplots import plot_acf
# Plot the interest rate series and the simulated random walk series side-by-side
fig, axes = plt.subplots(2,1)
# Plot the autocorrelation of the interest rate series in the top plot
fig = plot_acf(___, alpha=1, lags=12, ax=axes[0])
# Plot the autocorrelation of the simulated random walk series in the bottom plot
fig = plot_acf(___, alpha=1, lags=12, ax=axes[1])
# Label axes
axes[0].set_title("Interest Rate Data")
axes[1].set_title("Simulated Random Walk Data")
plt.show()