I want to store the average values of some data that is occasionally generated by users, which I then use in my application to predict future data. Now the problem I have is that this data may grossly change during the day - so for example users coming in at night time may generate much lower values then users coming in during the morning, so just keeping a simple average will not give me a reasonable prediction accuracy.
Some I need to store some kind of time based average - for example a naive solution would be to store the average value for each hour of the day - so I keep 24 averages, one for all the users that generated data between 12AM and 1AM, the second for all the users that generated data between 1AM and 2AM, and so forth.
I only have a few of issues with this approach: 1. to predict data properly I'd still need to consult a few values (lets say, 2 hours ahead and 2 hours back from now) which I may not have the resources to do. I rather consult a single value if it doesn't hurt my accuracy too much. 2. I also want to have this data remembered only for recent times - if very low values where generated a couple of years ago but since last month everyone is generating high values, then for me to predict data for the near future I need to be able to respond better then what an average of all the data ever created can give me. For the sake of the argument lets say that everything older then 90 days is not really relevant. 3. The reason that I want to use an average value and not just keep all the data ever generated by the users is that I expect a lot of data - I need to store such data for each of 100K to maybe 10M data points, for millions of weekly data entries from users - at the least. I also might want to split the data even further for each data point - maybe based on some user classification.
I'd appreciate it if anyone can give me some hints on how to best calculate my average data without required a huge data storage facility :-)
[hint - yes, its for a GIS application ]