Deret waktu musiman

Model ARIMA di Python

James Fulton

Climate informatics researcher

Data musiman

  • Memiliki pola berulang yang terprediksi
  • Berulang setelah periode waktu tertentu
Model ARIMA di Python

Dekomposisi musiman

Model ARIMA di Python

Dekomposisi musiman

deret waktu = tren + musiman + residual

Model ARIMA di Python

Dekomposisi musiman dengan statsmodels

# Import 
from statsmodels.tsa.seasonal import seasonal_decompose
# Uraikan data
decomp_results = seasonal_decompose(df['IPG3113N'], period=12)
type(decomp_results)
statsmodels.tsa.seasonal.DecomposeResult
Model ARIMA di Python

Dekomposisi musiman dengan statsmodels

# Plot hasil dekomposisi
decomp_results.plot()
plt.show()

Model ARIMA di Python

Menentukan periode musiman dengan ACF

Model ARIMA di Python

Mengidentifikasi data musiman dengan ACF

Model ARIMA di Python

Menghapus tren deret waktu

# Kurangi rata-rata rolling jangka panjang (N langkah)
df = df - df.rolling(N).mean()

# Hapus nilai NaN df = df.dropna()

Model ARIMA di Python

Mengidentifikasi data musiman dengan ACF

# Buat figur
fig, ax = plt.subplots(1,1, figsize=(8,4))

# Plot ACF
plot_acf(df.dropna(), ax=ax, lags=25, zero=False)
plt.show()

Model ARIMA di Python

Model ARIMA dan data musiman

Model ARIMA di Python

Ayo berlatih!

Model ARIMA di Python

Preparing Video For Download...