ranvar.periodicr
ranvar.periodicr(T.a ..) 🡒 T.r : ranvar, function
Converts time-series into ranvars by collecting observations over moving windows. Generalizes ranvar.segment
with an horizon expressed as a ranvar and events at the extrema or at the middle of the chosen time interval are equally taken into account:
D = ranvar.periodicr(
start: Items.Start // first date (inclusive) for each item
end: Items.End // end date (inclusive) for each item
horizon: Items.LeadTime // ranvar of lengths in day
censoredDemandDate: Censored.Date // days that are skipped when generating the ranvar
date: Orders.Date // date for each event
quantity: Orders.Quantity) // quantity for each event
Indeed, ranvar.periodicr
considers an infinite repetition of the input data and sums the event quantities over periods of all possible lengths contained in the horizon ranvar. As a consequence, if we consider the example above and we imagine an additional event of quantity 2 on Jan 7th, ranvar.periodicr
with dirac(3)
as the horizon would observe the following:
- Jan 1st - Jan 3rd: Q = 5
- Jan 2nd - Jan 4th: Q = 5
- Jan 3rd - Jan 5th: Q = 0
- Jan 4th - Jan 6th: Q = 0
- Jan 5th - Jan 7th: Q = 2
- Jan 6th - Jan 1st: Q = 2
- Jan 7th - Jan 2nd: Q = 7
and returns the ranvar ~28% Q = 0, ~28% Q = 2, ~28% Q = 5, ~14% Q = 7. For comparison, ranvar.segment
with horizon 3 and step 1 would ignore the last two lines of the above list and return 40% Q = 0, 20% Q = 2, 40% Q = 5.