Skip to content

Instantly share code, notes, and snippets.

@hexgnu
Created February 15, 2012 16:18
Show Gist options
  • Save hexgnu/1837002 to your computer and use it in GitHub Desktop.
Save hexgnu/1837002 to your computer and use it in GitHub Desktop.
0*x_1 + x_2 + x_3 + ... + x_29 = S_29
- x_1 + x_2 + x_3 + ... + x_28 = S_28
-------------------------------------
x_29 - x_1 = S_29 - S_28
x_29 = S_29 - S_28 + x_1
@maxjustus
Copy link

so given

28_day_total_feb_5 = 120
28_day_total_feb_6 = 100
28_day_total_feb_7 = 100
28_day_total_feb_8 = 30

we can infer that feb 7th 6th and 5ths daily value was 0
that january 8ths daily value was 120
and that january 10ths daily value was 70

I guess I'm struggling to see how to apply this algorithm to that data..

@hexgnu
Copy link
Author

hexgnu commented Feb 15, 2012

Say you have

Feb 6 = 120
Feb 7 = 130

Let's assume the data is somewhat tight (meaning lower stdev).

Feb 7 add would be 130 - 120 + (120 / 28)

120/28 is the average over the last 28 days

14 would be the answer

Why is it higher?

Well remember this is a rolling window and we just increased a bunch

@maxjustus
Copy link

I'll roll your window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment