python實現(xiàn)時間序列自相關(guān)圖(acf)、偏自相關(guān)圖(pacf)教程
自相關(guān)圖是一個平面二維坐標懸垂線圖。橫坐標表示延遲階數(shù),縱坐標表示自相關(guān)系數(shù)
偏自相關(guān)圖跟自相關(guān)圖類似, 橫坐標表示延遲階數(shù),縱坐標表示偏自相關(guān)系數(shù)
自相關(guān)圖與偏自相關(guān)圖的python代碼實現(xiàn):
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
plot_acf(b.salesVolume)plot_pacf(b.salesVolume)
可以看到,這個數(shù)據(jù)是偏自相關(guān)系數(shù)拖尾,自相關(guān)系數(shù)截尾的數(shù)據(jù)
補充知識:python 數(shù)據(jù)相關(guān)性可視化
話不多說直接上代碼
import matplotlib.pyplot as pltimport seaborn as snsdata = test_feature.corr() #test_feature => pandas.DataFrame#sns.heatmap(data)plt.show()
效果圖
以上這篇python實現(xiàn)時間序列自相關(guān)圖(acf)、偏自相關(guān)圖(pacf)教程就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. Python TestSuite生成測試報告過程解析2. 增大python字體的方法步驟3. Spring security 自定義過濾器實現(xiàn)Json參數(shù)傳遞并兼容表單參數(shù)(實例代碼)4. 在JSP中使用formatNumber控制要顯示的小數(shù)位數(shù)方法5. Vue作用域插槽實現(xiàn)方法及作用詳解6. IntelliJ IDEA設置默認瀏覽器的方法7. JAMon(Java Application Monitor)備忘記8. Python os庫常用操作代碼匯總9. Python 如何展開嵌套的序列10. 如何清空python的變量
