# Thread: Periodically calculating time based function

1. ## Periodically calculating time based function

Hello everyone. Hoping someone can shine some light.

I have a given event that happen over time. The event happens to be a specific individual accessing a specific resource on an intranet. Below lists some sample data listing the day the even happens.

08/03/12
08/03/12
08/03/12
08/01/12
07/31/12
07/31/12
07/31/12
07/31/12
07/31/12
07/31/12
07/30/12
07/30/12
07/30/12
07/30/12
07/30/12

I have a formula to compute the user-resource rank (r). T is the time for the rank being calculated (08/03/12) and T0 is the first data point (07/30/12). I show it as days, but some other definition of time would work.

r=SUM from t=T0 to T (1/ (1+(T-t)))

Given the above data, the rank equals 5.8333.

So today (08/08/2012), I get a hit by the person in question. I wish to calculate his new score. If I had all the old data, I could use the same formula with just one more data point. But I don't want to store the entire past history of each individual, and just want to score the last known score from the individual (5.8333) and the date it was calculated (08/03/2012). I would then depreciate this last score based on the duration from today and when it was created (5 days) and then increment it for the latest hit.

It's the depreciation part that's got me stumped. Intuitively, I would think this would be possible, but am not sure. If not possible, maybe some approximation?

2. ## Re: Periodically calculating time based function

Hi, NotionCommotion.

I'm intrigued by your problem, but I'm a little confused as to what T and T0 would be. What would they be for the specific data you've provided?

3. ## Re: Periodically calculating time based function

Hi GJA, Thanks for you reply. Yea, I am intrigued as well, but am struggling where to start.

T is the time that the rank is being calculated for (i.e. today). I accidentally showed it as 08/03/12 in my original post. I am undecided whether I want the resolution to be just to the nearest day (which was my original plan), or something finer. T0 is the first data point (07/30/12). The intent is for recent "hits" to have more weight than old hits.

So, giving this data, the rank today would be equal to 3.40 (the sum of the following). So, my objective is given only 5.8333 as 8/3/12 ranking, being able to calculate the rank 3 days later as 3.40.

Thanks again!

1/(1+(8/6/2012 - 8/6/2012)) = 1
1/(1+(8/6/2012 - 8/3/2012)) = 0.25
1/(1+(8/6/2012 - 8/3/2012)) = 0.25
1/(1+(8/6/2012 - 8/3/2012)) = 0.25
1/(1+(8/6/2012 - 8/1/2012)) = 0.166666666666667
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/31/2012)) = 0.142857142857143
1/(1+(8/6/2012 - 7/30/2012)) = 0.125
1/(1+(8/6/2012 - 7/30/2012)) = 0.125
1/(1+(8/6/2012 - 7/30/2012)) = 0.125
1/(1+(8/6/2012 - 7/30/2012)) = 0.125
1/(1+(8/6/2012 - 7/30/2012)) = 0.125

4. ## Re: Periodically calculating time based function

Hi GJA (or hi anybody!),

Did you have any ideas?

Thanks