Mulai "Memanaskan": Lihat Autokorelasi
Karena deret suhu, temp_NY, adalah random walk dengan drift, ambil selisih pertama agar menjadi stasioner. Lalu hitung ACF dan PACF sampel. Ini akan memberikan panduan mengenai ordo model.
Latihan ini adalah bagian dari kursus
Analisis Deret Waktu dengan Python
Petunjuk latihan
- Impor modul untuk memplot ACF dan PACF sampel
- Ambil selisih pertama dari DataFrame
temp_NYmenggunakan metode pandas.diff() - Buat dua subplot untuk memplot ACF dan PACF
- Plot ACF sampel dari deret yang sudah didiferensiasi
- Plot PACF sampel dari deret yang sudah didiferensiasi
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import the modules for plotting the sample ACF and PACF
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
# Take first difference of the temperature Series
chg_temp = ___.___
chg_temp = chg_temp.dropna()
# Plot the ACF and PACF on the same page
fig, axes = plt.subplots(2,1)
# Plot the ACF
plot_acf(___, lags=20, ax=axes[0])
# Plot the PACF
plot_pacf(___, lags=20, ax=axes[1])
plt.show()