1
$\begingroup$

I work in a contact center and want to create an new intra-day arrival pattern with R.

So far I've gathered a months worth of data, which is half-hourly. I've designated it as a time-series, decomposed it with STL. We can see a clear seasonal pattern. I've isolated the seasonal component in a variable and then wrote it to a csv file for use elsewhere.

data= ts(timeseriesRaw, frequency = 48) decompdata = stl(data, s.window = "periodic") plot (decompdata) seasonaldata = decompdata$time.series ["seasonal"] write.csv(seasonaldata, file = "Seasonaldata.csv", row.names = F)

enter image description here

The forecasting process currntly in use deals with multiple seasonalities - yearly, monthly & weekly - to create a daily forecast. This is then spread across the day based on the intra-day arrival pattern. This allows us to model with one less seasonality (intra-day). The current intra-day pattern has been shown to be inaccurate so I set about creating a new one.

Now my question is how can I use this daily seasonality to create an intra-day arrival pattern?

The pattern I've exported above looks like this:

seasonaldata Time Series: Start = c(1, 1) End = c(32, 22) Frequency = 48 1 0.5853415 -0.5630997 -2.4615408 -4.4224819 -4.5396731 -5.1881142 -7.0865553 -5.9537465 -5.8521876 -6.6574613 [11] -7.2127351 -7.7992588 -7.0107825 -5.2848063 -1.8400800 -4.3328537 -0.6381274 -2.5693483 -1.9068191 -0.5567899 [21] -0.2067608 -0.6067315 0.1423945 2.8239975 2.1507618 1.6694128 5.1558057 4.3518760 4.1608495 4.2278876 [31] 6.1336352 4.4909959 4.2999695 4.0457165 4.1785603 3.9888235 4.2506996 2.6416079 4.2583227 2.7137472 [41] 4.4594942 2.6899682 3.0172165 3.1831743 0.5426806 0.3860579 1.7133061 0.4276511 0.5853415 -0.5630997 [51] -2.4615408 -4.4224819 -4.5396731 -5.1881142 -7.0865553 -5.9537465 -5.8521876 -6.6574613 -7.2127351 -7.7992588 [61] -7.0107825 -5.2848063 -1.8400800 -4.3328537 -0.6381274 -2.5693483 -1.9068191 -0.5567899 -0.2067608 -0.6067315 [71] 0.1423945 2.8239975 2.1507618 1.6694128 5.1558057 4.3518760 4.1608495 4.2278876 6.1336352 4.4909959

I now need to transform this to give me a % for each half-hour time-slot which I can spread our daily point forecast over. So I'm looking for advice on the best approach to adopt or feedback on the general process.

Thanks in advance.

$\endgroup$
2
$\begingroup$

There are many ways of doing this. One simple way is to use the band pass filters. For instance, take a look at mFilter package. Suppose, your data set is monthly and you expect that there would be annual seasonality. You could apply cffilter function twice. First, extract the trend using dl=14, du=1000, this will pass only long waves, longer than 13 month cycles. Then apply it again to the resiudal with dl=6, du =13, this will pick up waves of 6 through 13 months length, which will be your seasonality. Whatever is left is the noise. This is a manual trend, seasonality and noise decomposition.

You could additionally analyze the original series with spectrum function. For the economic series AR method is most appropriate as the frequencies are relatively low and the standard signal processing tools such as FFT do not work very well. This will show you whether there is seasonality in the first place, and what are the cycle lengths (frequencies)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.