Mô hình ARIMA với Python
James Fulton
Climate informatics researcher





time series = trend + seasonal + residual
# Import
from statsmodels.tsa.seasonal import seasonal_decompose
# Phân rã dữ liệu
decomp_results = seasonal_decompose(df['IPG3113N'], period=12)
type(decomp_results)
statsmodels.tsa.seasonal.DecomposeResult
# Vẽ dữ liệu đã phân rã
decomp_results.plot()
plt.show()



# Trừ trung bình trượt dài trong N bước df = df - df.rolling(N).mean()# Bỏ các giá trị NaN df = df.dropna()

# Tạo hình
fig, ax = plt.subplots(1,1, figsize=(8,4))
# Vẽ ACF
plot_acf(df.dropna(), ax=ax, lags=25, zero=False)
plt.show()


Mô hình ARIMA với Python