Since you are dealing with correlation between two time series in this example, you do not want to simply rely on standard correlation measures, as these will not tell you anything about whether there is significance behind that correlation.
For this problem, I would be inclined to use cointegration to examine if there is a theoretically justified correlation between sales and COVID-19 cases.
Let's take an example using Python.
Two random arrays of numbers with mean = 100 and standard deviation = 10 are generated in Python.
mu_1, sigma_1 = 100, 10 # mean and standard deviation mu_2, sigma_2 = 100, 10 # mean and standard deviation data1 = np.random.normal(mu_1, sigma_1, 1000) data2 = np.random.normal(mu_2, sigma_2, 1000)
Cointegration results are generated in Python using ts.coint:
```
coin_result = ts.coint(data1, data2) coin_result
(-31.93013915989978, 0.0, array([-3.90743646, -3.34225305, -3.04869817])) ```
With a p-value of 0.0, this implies that the two series are perfectly cointegrated, which we would expect since they both follow a normal distribution and have the same mean and standard deviation. If the p-value were greater than 0.05, then the series is not indicated to be cointegrated at the 5% level of significance.
However, reality will be different, as two series never follow exactly the same distribution. Even if two series are cointegrated, it will never be perfect cointegration.
In your case, you could see if sales fluctuations and COVID-19 cases show cointegration. However, I would caveat that you should be using active cases instead of cases outright.
This is because the total number of cases can never decrease, it can only increase or flatline. Given that you will inevitably see fluctuations in sales, then the vastly differing distributions will mean that your series will never be indicated as cointegrated - which may not be true in reality.
In terms of looking at sales in isolation, you could also use a Chow Test to examine for the presence of a structural break, i.e. if the series is significantly different before and after the outbreak.
To summarize, I would be inclined to:
1. Test for cointegration between active cases and sales
2. Of those segments that do show cointegration between active cases and sales:
a. Run a <PERSON><PHONE_NUMBER>])) ```
With a p-value of 0.0, this implies that the two series are perfectly cointegrated, which we would expect since they both follow a normal distribution and have the same mean and standard deviation. 139
If the p-value were greater than 0.05, then the series is not indicated to be cointegrated at the 5% level of significance.
However, reality will be different, as two series never follow exactly the same distribution. Even if two series are cointegrated, it will never be perfect cointegration.
In your case, you could see if sales fluctuations and COVID-19 cases show cointegration. However, I would caveat that you should be using active cases instead of cases outright.
This is because the total number of cases can never decrease, it can only increase or flatline. Given that you will inevitably see fluctuations in sales, then the vastly differing distributions will mean that your series will never be indicated as cointegrated - which may not be true in reality.
In terms of looking at sales in isolation, you could also use a Chow Test to examine for the presence of a structural break, i.e. if the series is significantly different before and after the outbreak.
To summarize, I would be inclined to:
1. Test for cointegration between active cases and sales
2. Of those segments that do show cointegration between active cases and sales:
a. Run a Chow test to see if there is a structural break between sales pre and post COVID-19
b. Compute descriptive statistics for sales across these two periods, e.g. average sales pre and post, standard deviation of sales pre and post, etc.
This way will likely give you better insights as opposed to simply relying on correlation measures, which are likely to be misleading for the reasons I have mentioned. 139