1
$\begingroup$

scenario:

lets say I have a table for number of customers visiting a shop per day. now I want to calculate that how much change has happened in terms of number of visitors throughout the past 30 days and come up with a single value that tells me the change rate (in percentage). but I do not want to compare the changes of current month with the values of the previous month(s) instead I want to compare the current month with itself! I have some naive solutions but I am not a data scientist and am not sure if the solution would give me a meaningful value at all!

my first question: is this a meaningful question at all (to compare a data set with itself)?

my second question: if so, how would you approach the solution?

solution one: one solution that I thought about was to compare the value of the first day with the value of the last day, but then It seemed a bit stupid because values could fluctuate randomly in between and the result would not represent the fluctuations.

solution two: another solution that I could think of was to compare the value of each day (within the month) with the value of the day before it and then calculate the change ratio and finally accumulate all the ratios and come up with a single value!

side note: i would like to get both positive and negative percentage depending on the change ratio

$\endgroup$

1 Answer 1

1
$\begingroup$

Some suggestions:

  1. Your ideas in solutions were basic but solid. For example the fluctuations in second idea can be smoothed out with a simple moving average and then applying your idea makes sense.
  2. Another idea is to set the value of first day as threshold and calculate the total negative (drop from threshold) and positive (raise from threshold) through the month. Let's say in a constant month (a month in which all 30 days have exact same values) the percentage of change is 0%. It means that sum of above-threshold values and under-threshold values can give you an estimate of change in percentage according to the first day. An example is [5, 10, 50, 100, 5, 1] visits during 6 days. we set the value of first day ($5$) as threshold. Then you will have [0%, 100%, 900%, 1900%, 0%, -400%] are the raises and falls (why?!) and you can use any numerical calculation to come up with a final number e.g. 2900% raise and 400% fall which can be 2500% raise at the end.
  3. Playing with the idea above gives many different methods of doing this. Instead of comparing each day to first day, as you also mentioned, compare it to only previous day and come up with a final change rate. Or consider a penalty for negative changes e.g. if in one case values are strictly raising and final change is +3000% and in another case values fluctuate but finally the change is 3000% again, you can consider a weight for the second one so the difference between them is preserved.
$\endgroup$
2
  • $\begingroup$ Thanks @KasraManshaei for the detailed answer. I was wondering if there is a standard way(s) to come up with the initial threshold value $\endgroup$
    – sepisoad
    Mar 7 at 17:34
  • $\begingroup$ Welcome! actually the initial value is the least fuzzy concept here. The value of first day is actually pretty good choice. BTW as the community is non-profit and all what we get is scores, please consider accepting (if the answer solved your problem) or upvotting (if it helped you) the answer. Thanks $\endgroup$ Mar 7 at 17:42

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.