I have a periodic time series, of air temperature over several years, and I want to be able to predict future values for it.
I've calculated the average over the available years of the value at each hour of the year, which works ok, but it's clearly quite noisy, since I only have 4 years data.
lm.circular
, which looks like a feasible solution candidate.lm.circular
using a 1-order polynomial, but a practical problem arose: it ran out of memory. Note that a standard lm
is almost instantaneous, and uses no noticeable memory, on the same datalm
is not really an option, since it gives terrible results at either end of the period.I'm not quite sure which way is the best way forward, but I suspect that this is a pretty common problem, and there are probably very standard ways of dealing with it?
Ok, I found a super-easy way in the end. You don't need any fancy packages, you simply use standard lm
and apply cosine and sine to the timeline:
model <- lm( y ~ I(sin(x/periodlength*2*pi) * I(cos(x/periodlength*2*pi)), trainingdata )
... .then you can tweak this formula to your heart's content.
(Edit: oh yeah, and it's super fast and doesn't use much memory).