2016-04-19 26 views
-1

我有一個時間序列數據,我正在執行異常處理。
分解我正在使用STL函數。我想生成給定格式的輸出:STL分解R

ID Actual Trend Seasonality Random Smooth 

請幫助我以這種格式生成輸出。

+0

您好,請看看[在此鏈接(http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)和修改你的問題。 – Sotos

回答

0

不確定什麼是ID,但是這會創建一個包含實際時間序列和分解的數據幀。

x <- stl(nottem, "per") 
y <- data.frame(nottem, x$time.series) 
head(y) 

    nottem seasonal trend remainder 
1 40.6 -9.347198 49.68067 0.2665254 
2 40.8 -9.855250 49.54552 1.1097288 
3 44.4 -6.853301 49.41037 1.8429318 
4 46.7 -2.763471 49.32862 0.1348488 
5 54.1 3.501357 49.24688 1.3517676 
6 58.5 8.983303 49.21027 0.3064259