[R] More help with stl?

rkevinburton at charter.net rkevinburton at charter.net
Tue Sep 2 17:38:25 CEST 2008


I don't understand the output of stl. As a simple example:

y <- numeric(1:365)
y[250] = 1

stl <- stl(ts(y, frequency=7), s.window="periodic")

This returns without error but the results are puzzling to me. If you plot the results it is probably easiest to visualize what I mean.

plot(stl)

This shows the original data (a single spike at 250). A trend (which also shows a bump at 250). It is the rest that I have a question on. For the "seasonal" component it seems to show a sinusoid like wave with a period roughly a week (7 days) long all with the same amplitude. I can't see how a single spike can generate a "seasonal" component that is periodic for every period in the data. Finally the "remainder" portion of the data generated seems to show just what I want, a representation of the input. But if this is ruly the remainder (data - (trend + seasonal)) then shouldn't it have all entries close to zero? Please help me with my misunderstanding if you have any experience with stl. 

Finally it has been suggested that in order to find an overall formula to represent the data a model will need to be constructed. I unfortunately don't have any experience in developing a model. Any hints on where to start?

Thank you.

Kevin



More information about the R-help mailing list