Re: [R] stl,package=stats

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Mon 19 Jul 2004 - 04:00:32 EST

bob mccall wrote:
> Greetings:
>
> I'm using the time series decomposition routine "stl" from the package "stats".

> But how do I get the results into a vector to work with them?
> example:
>

> data(AirPassengers)

> m<-stl(AirPassengers,"per")

> print(m)
>

> This lists the output but can't figure out how to extract the individual series like seasonal, trend, irr
egular.

There are two ways:
Either use str(m) to look at the structure of the object or read the help page ?stl which tells you that

   ... 'stl returns an object of class "stl" with components

    time.series     a multiple time series with columns
                    seasonal, trend and remainder.' ...

I don't know whether there are any specific extractor methods, but to extract the decomposed seasonal values, you can simply write:

    m$time.series[,"seasonal"]

Uwe Ligges

> Thanks,
> Bob
>
>
> ---------------------------------
>
> Vote for the stars of Yahoo!'s next ad campaign!
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 19 04:09:00 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:04 EST