# Weighted discrete measurements of a value changing over time

The best way I can think to describe this question is by example: Imagine there is a ship sailing around the pacific ocean on an unknown path (possibly random.) Other ships passing by sometimes see this ship and radio in its location to me. Some of these scout ships have better instruments or a more trustworthy crew than others, so I assign an accuracy weight to each of them. If the ship were static, it would be a simple problem to collect all of the reports and calculate an area where the ship is located (with high probability.) How can I adapt this for when the ship is constantly moving (assuming a fixed speed.) Obviously newer reports need to be given more weight and older reports need to be "faded out" so the ship's calculated location changes over time.

I started trying to design something like this but I think I'm making it too complicated.

Is there a name for this sort of problem? Any suggestions for a good method to solve it? Thanks!

-
That was just a hypothetical example. I'm not using this algorithm for geolocation. –  takteek Mar 26 '11 at 1:59

## migrated from stackoverflow.comMar 26 '11 at 10:25

This question came from our site for professional and enthusiast programmers.

Sounds like you might want to look at (Weighted) Moving Average.

-
Thanks, I think. :) This is essentially what I was already doing but knowing what it's called will help. If there are no better answers after a while I'll accept this. –  takteek Mar 26 '11 at 2:06
@Mitch Wheat: Was speaking more towards the Weighted Moving Average. By using the moving average you can get the average speed/direction which will allow one to predict where the next location might be. The weighting gives him the ability to "phase out" the older reports. –  Suroot Mar 26 '11 at 2:07
Particularly for more complex systems, Kalman filtering and related methods should be investigated as well. –  Anonymous Mar 26 '11 at 2:31
@user57368 Thanks, that's looks very helpful. The "Example application" section on that page is basically a better-worded and more complete version of what I was trying to describe. If you want to post that as an answer I'll accept it. Sorry, Suroot. Your answer was helpful too though. :) –  takteek Mar 26 '11 at 3:39
Oops. When I said "that page" I meant the Kalman filter page on Wikipedia. I guess I only imagined that you linked to it. –  takteek Mar 26 '11 at 3:49