[R] Help with STL function in R compared to S-Plus

Andrew White anwhite at worldnet.att.net
Wed Oct 22 13:08:42 CEST 2003


I am trying to understand the nuances of STL (seasonal trend 
decomposition with loess) based on William Cleveland's (and others?) 
original development. I do not understand the specification or use of 
"frequency components" or equivalent "low-pass filter" components in 
the stl() function.

I have run the stl() function on a standard example data (co2) in both 
S-Plus and in R version 1.8 and the stacked-panel plots are different. 
The R version shows only rawdata, seasonal, (long-term) trend and then 
remainder (residual).  The S-Plus version of the plot shows in addition 
plots for the specified "frequency components". Why ?

In both versions of stl() the user specifies a univariate time series, 
and the length of window for a seasonal component, a trend component 
and one or more frequency (or low-pass filter) component(s).

Using the data "co2" as example, the S-Plus specification is something 
like:
   stl(co2, ss.window=17, fc.window=c(101,25), fc.degree=c(1,2)))

The near-equivalent specification of stl in R is something like:
   stl(co2, s.window=17, l.window=c(101,25), l.degree=c(1,2))

The user has the option of selecting multiple frequency components in 
S-Plus asa concatenation of values, as:  fc.window =c(101,25)  as the 
S-Plus stl help page  example shows. It is NOT clear if such a 
specification actually works in the R implementation of stl(), although 
summary() of the stl output object shows that the values are entered 
and stored in the routine.

Can anyone help explain the use and "tuning" of "frequency components" 
in S-Plus version of STL and the parallel "low-pass filter" components 
in R ? the RESULTS of specified frequency components show up in the 
stl.plot in S-Plus as additional plot panels, whereas the low-pass 
filter results do not! Only the raw-data, then seasonal, then trend, 
and finally residuals plots are stacked up. This is what confuses me 
the most: why the same routine from Wm. Cleveland and same named 
function would show 2 different results and plot formats in S-Plus vs R.

Thanks very much for any help with this matter.
Aloha from Hawaii, Andy White

email: anwhite at att.net; andrew_white at hmsa.com




More information about the R-help mailing list