Quantcast

stl function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

stl function

kateg
Hi all,

I'm working on decomposition and comparison of several time series. I'm interested in extracting the trend components for each time series using the stl function and overlaying them on one another.  

I'm not sure how to plot the trend function alone and to do the overlay using some kind of loop. If anyone has any insight that would be great!

thanks,

Katie
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stl function

Achim Zeileis-4
On Fri, 9 Jul 2010, kateg wrote:

>
> Hi all,
>
> I'm working on decomposition and comparison of several time series. I'm
> interested in extracting the trend components for each time series using the
> stl function and overlaying them on one another.
>
> I'm not sure how to plot the trend function alone and to do the overlay
> using some kind of loop. If anyone has any insight that would be great!

stl(...)$time.series

is a "ts" series containing seasonal/trend/remainder. Thus, the trend can
be extracted via

stl(...)$time.series[, "trend"]

See ?stl for more details.
Z

> thanks,
>
> Katie
> --
> View this message in context: http://r.789695.n4.nabble.com/stl-function-tp2283891p2283891.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stl function

kateg
Hi there,

I tried the code that was sent. Thanks a lot.  It doesn't seem to work.

Here is what I'm working with...


inc<-ts(incdat[,2], start=1968.000, freq=12)
par(mfrow=c(1,2))
plot(stl(log(inc), s.window="periodic"))
Loading...