# Calculating Median Speed with Spotty Data

I have a situation where I need to calculate the speed of a vehicle for a given time period. The data I'm working with is very spotty in the temporal dimension— we might have 5-10 speeds recorded within seconds of each other, but other speeds in the set might be many seconds or minutes apart. The speeds can sometimes be wildly inaccurate which is why we're using median instead of mean.

What we're noticing is this: because of the spottiness of the data, clusters of closely recorded points tend to skew the results of a median calculation because they take up a large amount of the sorted set from a count standpoint, but only represent a relatively small amount from a temporal standpoint.

We've considered interpolating the points (using a linear function) between large gaps in our measurements in order to smooth it out.

Question: is there a better way to solve this problem than by interpolating missing points? Is there a better option than using median (assuming we'll have outliers)?

• How dynamic do you expect your speed to be? Do you have better information on your acceleration? (Speed is a simple function of acceleration and time.) Could you pull a sample of your data based upon defined time intervals? – Tavrock Apr 10 '17 at 18:37
• Unfortunately that's the problem— I can't get the data for a set time interval. I'm working with data that comes from a GPS that has spotty connectivity. There will be moments where it has a great connection and plenty of regularly spaced points, but other times it might have a bad connection and not update itself for long periods of time. – Jim Heising Apr 11 '17 at 16:48