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
  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:

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.