statsmodelsで季節成分分解

時系列解析




statsmodelsで季節成分分解

季節成分の抽出

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
import statsmodels.api as sm
 
res = sm.tsa.seasonal_decompose(X, freq=16)
 
#トレンド成分
trend = res.trend
#季節成分
season = res.seasonal
 
#図示
fig = plt.figure(figsize=(16,8))
ax = fig.add_subplot(111)
ax.plot(trend, label='trend')
ax2 = ax.twinx()
ax2.plot(season, c='orange', label='season')
plt.legend()
plt.show()


タイトルとURLをコピーしました