[R] dynlm question

Dave Evens
Mon, 20 Jun 2011 18:37:09 -0000

Dear All,

I'm trying to use dynlm to fit a time series.

I have 3 seasonal terms. Here is an example of the problem.


This is my time variable, hourly data:
timeSeries <- seq(as.POSIXct("2011-01-01 00:00:00"),
as.POSIXct("2011-12-31 23:00:00"), by="hour")


My response
is:
y <- rnorm(length(t), 1000, 500)

There are 3 seasonal factors:
t.h <- as.POSIXlt(t)$hour      # hours of the day

t.d <- as.POSIXlt(t)$wday      # days of the week
t.m <- as.POSIXlt(t)$mon            # months of the year

I can create a time series object for the hour, by doing

t.hh <- ts(t.h, freq=24)

but how to I create time series objects for the day (t.d) and the month (t.m)?

I tried

t.dd <- ts(t.d, freq=t.d)

but this doesn't work.

I would appreciate any help.

Regards,
Dave

	[[alternative HTML version deleted]]