1
votes

Can anybody suggest resources for time-series data manipulation. I'm not looking for time-series statistical analysis (e.g. ARIMA,Forcasting, etc). Instead, I want to extract a portion of data based on a time segment.


Thanks Dirk & Mohsen! @Dirk: I'll definitely try zoo. I heard that it's good for TS, but for some reason just slip out of my mind. @Mohsen: I didn't use decomposition method. But I tried stl, & it gives me lot of errors. I wish I can get more details on it.Also, I looked for the link that you provided me. But that is working on TS using other software. I don't have problem with statistical analysis with TS. But I'm having problem in TS data manipulation in R.

Also, majority of the time I deal with daily,weekly & monthly data. But the examples that I come across is yearly data. So, whn I try to replicate the examples in my dats set I get set I get lots of errors. i can't able to format the daily,weekly & monthly stats. E.g. I want the following code in weekly format. But when I put the date in "start" segment, it gives me error. That's why I'm looking for some resources which gives examples only on time-series data manipulation All kind of manipulation. Once I can extract required data in time-series fromat I can run statistical analysis.

data<-ts(data[,1],start=1956,freq=12)

3
-1 for vagueness including the subsequent answer which should have been a comment and which is also too vague with no code shown and no examples of input and desired output. Also the answer/comment seems to change the question somewhat and there are vague references to things that the poster can't seem to get to work without specific code showing the errors made.G. Grothendieck

3 Answers

6
votes

Please look at the documentation of the zoo package which comprises a number of subsetting and aggregation operations.

3
votes

Here are some links to some previous stl() questions:

Calculating Start for stl()

Feeding an hourly zoo time-series into function stl()

Be careful how you model seasonal data. It gives a whole new meaning to the term "spurious regression".

x <- rnorm(200)
x.ts <- ts(x, start=1956, freq=12)
x.stl <- stl(x.ts, s.window = "periodic")
plot(x.stl)

x.dec <- decompose(x.ts)
plot(x.dec)

Here are some additional time series links:

Which R time/date class and package to use?

http://cran.r-project.org/web/views/TimeSeries.html

http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm

http://casoilresource.lawr.ucdavis.edu/drupal/book/export/html/100

0
votes

If you are familiar with Python, I would suggest using scikits.timeseries OR the timeseries features of the more-recently-maintained panda

Specifically for time segments, panda provides the follows construct:

A truncate convenience function is provided that is equivalent to slicing:

ts.truncate(before='10/31/2011', after='12/31/2011')