1
$\begingroup$

I have plotted the frequency of items sold through time, trying to determine the trends by moving average. I considered a 5-days window. I would like to know if this approach makes sense and how I could interpret the results. It's my first time with time-series and moving average (I have no a scientific background at all).

I hope you can help me.

enter image description here

$\endgroup$

2 Answers 2

3
$\begingroup$

Yes it makes sense, a moving average makes the curve "smoother" in the sense that it's less sensitive to short variations. This usually makes it easier to observe the general tendency.

You could also try different time periods for the average, e.g. 10 days or 15 days.

It looks to me like there's a moderate increase trend in your data, but the variations are important and the time window is short, so it's too early to be sure. You could apply linear regression to confirm the increase.

$\endgroup$
4
  • $\begingroup$ Could you please tell me more regarding linear regression to apply to this case? What insights should I get? $\endgroup$
    – LdM
    Jun 21, 2020 at 0:27
  • 1
    $\begingroup$ @LucaDiMauro linear regression is a method to find the straight line which fits your data points as close as possible. So if you actually have an increase in your data, you will see the straight line going up, and the slope of the line (how steep it is) tells you how fast is the growth. It's useful but be careful not to "trust" linear regression too much: since your data is a bit small and has lots of variations, the growth according to linear regression is not at all a guarantee that it will keep growing this way ;) $\endgroup$
    – Erwan
    Jun 21, 2020 at 0:54
  • $\begingroup$ Thank you so much @Erwan. So I would need just to consider linear regression for the actual data, not the predicted one by moving average, would I not? $\endgroup$
    – LdM
    Jun 21, 2020 at 1:02
  • 1
    $\begingroup$ @LucaDiMauro well it depends what you want to obtain, linear regression gives a very simplified representation of the trend. $\endgroup$
    – Erwan
    Jun 21, 2020 at 11:38
3
$\begingroup$

Moving averages will give you a smoother time series so that a trend is easier to see by eye. This approach makes sense when you’re exploring the data.

The next step is to try to comment on where the time series will go next. Based on the tags you have chosen for your question, you are comfortable writing python. You might consider Facebook’s open source time series forecasting package. This will allow you to analyse the seasonality of your sales (e.g. how does the day of the week or the month of the year have an effect?) and allow you to understand what the trend is doing when the seasonal effects are removed. There tutorial for the python API is here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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