Skip to content

POSIXct to ts

5 messages · Mary Ann Middleton, R. Michael Weylandt, Pascal Oettli

#
On Thu, Aug 9, 2012 at 3:30 PM, Mary Ann Middleton <maberg at sfu.ca> wrote:
Thank you for the dput()-ed data!

The "time series" object that stl() and decompose() expect doesn't
have time stamps -- rather it has a "start" and "end" marker as well
as a frequency. [For more details, see ?tsp]

With your described data, I'd imagine you'd have start = 2008 and
frequency = 365*24 (if you have hourly data and an underlying yearly
periodicity) but to work with the data you gave, lets suppose 12 hours
is a cycle. Note you don't have to give end because that's figured out
automatically from frequency and start.

x.ts <- ts(x[,2], start = 1, frequency = 12)

then I can

stl(x, "per")
decompose(x)

as desired.

Hope that helps,
Michael
#
Hi Mary Ann,

I'm afraid I'm not really qualified to answer, though someone else on
this list might be: I might suggest you ask on CrossValidated
(stats.stackexchange.com) where a bunch of nice folks who know far
more than me about these matters answer statistical questions. In
particular, I know Prof Hyndman is seen there on occasion and he could
certainly give you an answer.

Cheers,
Michael
On Thu, Aug 9, 2012 at 11:02 PM, Mary Ann Middleton <maberg at sfu.ca> wrote:
#
Hello,

decompose() works with moving averages to define the components of the 
time series.

stl() uses loess (Local Polynomial Regression Fitting) to define the 
components.

Regards,
Pascal



Le 10/08/2012 13:02, Mary Ann Middleton a ?crit :