I have some data on a cyclists distance traveled and hours it took.
MILES HOURS MPH DAYS_AGO WEIGHT
0 2 5 0.4 10 0.3175
1 5 10 0.5 4 0.3375
2 14 20 0.7 2 0.3450
I am trying to get an average of MPH
for the cyclist.
The WEIGHT
column in this table is using an exponential time decay to get the appropriate weight 0.99 ^ DAYS_AGO
so samples further back in time have smaller weights.
The issue I am stuck on is this becomes a weighted average since the HOURS
per row differ but then there is an additional weighting source which is the exponential time decay.
Would something as simple as sum(MILES * WEIGHTS)
/ sum(HOURS * WEIGHT)
work for this?
sum(miles) / sum(hours)
but I would like this to also be weighted by the WEIGHT column in this table which is an exponential time decay where it gives a higher weight to more recent observations @whuber $\endgroup$