This is probably a pretty simple question for most of you.

I have weekly amount of users from last 2 year till now for 2 traffic sources. Want I want to figure out is to see in which periods these sources deviate from the trend. Regarding trends I do not know which model to choose.

Since the traffic is very seasonal I don't think a standard deviation will suffice. Which trend model is best to choose here or is there a better method?

  • $\begingroup$ post your data and I will try and help .. you are asking for the identification of anomalies vi Intervention Detection $\endgroup$ – IrishStat Mar 20 '18 at 21:02
  • $\begingroup$ @IrishStat thanks, I will check tomorrow if I can share it. (it's from work) is it something that I can do in a spreadsheet? Either way I will deepdive in it. $\endgroup$ – Christoph Mar 20 '18 at 21:09
  • $\begingroup$ if you can't share the real data then code it to mask the values and post a csv file $\endgroup$ – IrishStat Mar 20 '18 at 21:17
  • $\begingroup$ you can find the data below. I did a formula on all cells to mask the data (i am not sure how it's done normally), Hopefully it's usefull for you. By the way I am a marketer not a data scientist, so this is a bit new to me. docs.google.com/spreadsheets/d/e/… $\endgroup$ – Christoph Mar 21 '18 at 9:36
  • $\begingroup$ I am a little confused. Is this 128 consecutive weeks of data or is it 64 weeks of data for 2 different segs ? It appears to be 64weeks of data for two traffic sources. $\endgroup$ – IrishStat Mar 21 '18 at 10:03

Very simple question with a not so simple answer ! In order to detect the periods that deviate from the trend one has to detect the trend in such a way that any existing deviations do not distort the identification of the trend. This is what is meant by "robust identification".

I took the 64 weekly values for segment1 and coded them withiut loss of generality for clarity. enter image description here . In order to answer your question , I need to define "trend" and "deviate from trend ... anomaly"

The general definition of what a trend is : The general course or prevailing tendency”

From http://cucis.ece.northwestern.edu/projects/DMS/publications/AnomalyDetection.pdf Anomaly detection refers to the problem of finding patterns in data that do not conform to expected behavior. These non-conforming patterns are often referred to as anomalies, outliers, discordant observations, exceptions, aberrations, surprises, peculiarities or contaminants in different application domains. Of these, anomalies and outliers are two terms used most commonly in the context of anomaly detection; sometimes interchangeably.

I took your 64 values and using simultaneous identification strategies as I discussed here How to determine order of sarima? , I obtained the following useful equation presenting regular behavior (arima structure) and the empirically identified deviant structure (pulses). enter image description here . The Actual/Fit and Forecast (not asked for) is here enter image description here with a very clear rendition of the "deviate from normal" here enter image description here . The residuals from the model suggest sufficiency enter image description here

An ARIMA model is simply a weighted average.It answers the double question: How many period (k)should I use to compute a weighted average and precisely what are the k weights. It answers the maiden's prayer to determine how to adjust to previous values (and previous values ALONE) in order to project the series (which is really being caused by unspecified causal variables). Thus an ARIMA model is a poor man's causal model .

in our case the "trend component" is a simple two period weighted average (k=2) of the past using the most recent value and the value three periods ago. The weights are 56.1% and -34.2% and a constant 781.864 enter image description here shown for period 65. Note that in this form the prediction equation includes a slight adjustment due to the anomaly/pulse at period 64.

Hope this helps ...

By the way , my non-invasive coding of your submitted numbers was 1) subtract 2620000000 and then 2) divide by 1000 .... enter image description here ... 64 numbers/values is to brief/short to validly identify/model seasonal structure although one could assume a model perhaps auto-regressive (seasonal arima) or seasonally deterministic (weekly dummies).


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.