-1

I have a time series data on which I am performing outlier treatment.
For decomposition I am using the STL function. I want to generate an output in the given format:

ID Actual Trend Seasonality Random Smooth

Please help me to generate the output in this format.

  • Hello, please have a look [at this link](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and revise your question. – Sotos Apr 19 '16 at 12:00

1 Answers1

0

Not sure what ID is, but this creates a data frame with the actual time series and decomposition.

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
Whitebeard
  • 5,945
  • 5
  • 24
  • 31