Im trying to understand if a weekly number of certain metric (i e orders) has changed significantly during last week based on the performance of the previous 4 weeks.
I only take 4 weeks in the past to make sure seasonality is not big factor here + use Poisson distribution.
Let's say that mean (and lambda) of the previous 4 weeks is 5000 orders and the last week we got 4800 orders.
Then the probability of the number of orders being 4800 or lower is:
sum of (
)
Here is my code to calculate it:
from scipy.stats import poisson
rv = poisson(5000)
sum = 0
for num in range(0,4800):
sum += rv.pmf(num)
print(sum)
print(foo)
The result is 0.0021
Now, the common sense says its too small given it is just (4800-5000)/5000 = 4% down from the mean.
I suspect it is because 5000 is too big number for Poisson distribution - all the example i found were about smaller numbers.
Is this correct and how to work around it?
Your common sense says, in effect, "4%, no biggie, that's only $1/25$ of the total". What your calculations are telling you is that a fluctuation of this size is pretty big, given the total volume of sales.
A Poisson distribution with expectation $5000$ is well-approximated by a normal distribution (see this for example), and you are taking about a deviation of size $(4800-5000)/\sqrt{5000}\approx -2.8$ standard deviations. One would expect such a deviation about one time in $400$ or so.
Details: you know the expectation of a $\text{Po}(\lambda)$ random variable is $\lambda$; you should also know that its variance is also $\lambda$. So if $X\sim \text{Po}(\lambda)$ , the mean and variance of $Z=(X-\lambda)/\sqrt{\lambda}$ are $0$ and $1$, respectively. For other reasons $Z$ is approximately standard normally distributed, so your tail area is approximately $\Phi(-2.8)\approx .0023$, which is fairly close to what your exact calculation gave.
Whether this adds up to "significant" depends on what action you might take on this evidence. Are you wondering if you want to ask the advertising manager for a comment at the next sales meeting, or are you wondering if you want to sue your advertising firm? I can't tell. But the figure 4% is not what you should be concentrating on.