The plan is to digest GPS point updates into speed statistics for way segments. The statistics will be keyed to:
way_id, node_start_index, node_end_index, hour_of_week
The easiest way to store speed statistics as a rolling average, with fields
In this case, every time a new speed is detected which matches the key, count = count+1 and mean=((mean*count)+newSpeed)/(count+1). That's simple enough.
But what if we want to know the distribution of speeds? How can we update such a distribution incrementally?
The plan is to digest GPS point updates into speed statistics for way segments. The statistics will be keyed to:
The easiest way to store speed statistics as a rolling average, with fields
In this case, every time a new speed is detected which matches the key,
count = count+1andmean=((mean*count)+newSpeed)/(count+1). That's simple enough.But what if we want to know the distribution of speeds? How can we update such a distribution incrementally?