Skip to content

Timeseries data, lattice, and model formulas?

4 messages · icosa atropa, Gabor Grothendieck

#
Hello All,

I'm using R for a rather large, multivariate timeseries dataset of ~4
million records.  So far I've divided the set and used conventional
data frames with good success at visualizing, summary statistics, etc.

I've experimented with dedicated timeseries packages like its and zoo
for more complicated analysis, but support for things like factors,
lattice and model formulas seems lacking.  Am I missing something, or
are data frames the most appropriate vehicle for large, multivariate
timeseries?

thanks so much
christian
university of new mexico
#
On 7/5/07, icosa atropa <icos.atropa at gmail.com> wrote:
Don't know what you are looking for with respect to factors but if you create
a zoo object from a factor it remembers where it came from:

   > zf <- zoo(factor(c(1,1,2)))
   > class(zf)
   [1] "zoo"
   > str(zf)
   atomic [1:3] 1 1 2
    - attr(*, "levels")= chr [1:2] "1" "2"
    - attr(*, "oclass")= chr "factor"
    - attr(*, "index")= int [1:3] 1 2 3
zoo explicitly supports lattice with xyplot.zoo, e.g.

library(zoo)
library(lattice)
example(xyplot.zoo)
In conjuction with dyn or dynlm zoo supports model formula:

library(dyn)
set.seed(1)
z <- zoo(rnorm(10))
dyn$lm(z ~ lag(z, -1))
#
Thanks for the reply.  I need to read up on dynlm.
R.e. factors, I have something that looks like this - the first 3
columns have identifying info, and are the factors that I give to
lattice, whereas the last column is the actual timeseries.
unit_id  well_num              sampled_on                      dtw_m
 M1     :5   N:5        Min.   :2005-08-04 15:30:00    Min.   :-1.571
 M2     :0   S:0       1st Qu.:2005-08-04 15:45:00    1st Qu.:-1.570

Would the most logical way to use zoo be to create an object for each
element in the factor matrix, i.e. M1N, M1S, M2N, M2S, ... , and
create a list or environment of the objects?

Thanks!
christian

  
    
#
On 7/6/07, icosa atropa <icos.atropa at gmail.com> wrote:
To use dyn just preface lm, glm, etc. with dyn$
Please provide something reproducible and show what you want to do without
zoo.