# find the difference between the expected sales and the actual sales

A little bit of background: I have daily demand data for our product from 1 January 2017 to 31 December 2022. Sometime after Covid-19 struck say 1 March 2020, the sale of our product went up substantially (sales in 2021 were 8X sales in 2019) and the demand has sustained till date (March 2023).

Now, my manager has asked me to find out what the sales would be if Covid hadn't struck viz. if we had continued at the same sales levels we were at pre covid and find the difference between the expected sales (estimated using pre-covid numbers) and the actual sales.

I believe I'm not able to find something online since I don't know the exact area of study to look for.

I have the following questions:

1. What is the broad area of study or technique that deals with the above problem? I assume it would be something like promotional analysis where one tries to model the effect of a promotion/discounts to see how the sales are affected.
2. Are there any specific techniques that you would suggest that would help me solve this problem? Techniques could be statistical: based on distributions/tests or ML oriented or any other ones.
• What does your data for the period 1/1/2017 to 31/12/2019 look like? That would help you to decide on a model for your data. For example, knowing whether seasonal variations are important or not would change the analysis. Mar 20, 2023 at 7:05
• I can't share the data or plots for proprietary reasons but yes we have seasonality on a quarterly basis. Mar 20, 2023 at 8:29

As Sextus writes, this is a case of time series forecasting. Here are some resources: Resources/books for project on forecasting models Since you write that you have daily data, this sounds a lot like retail sales to me, so you might be interested in this introduction to retail forecasting and the references therein.

I basically see two possibilities.

1. You could fit a model to the data pre-COVID, then forecast out into the COVID time frame.
2. You could fit a model to all your data, but including one or more predictors to capture the COVID effect. (If COVID had different effects at different times, e.g., driven by different lockdowns, you may want to use multiple predictors.) Then calculate the model fit across the COVID time without the COVID predictors.

The two approaches will yield different results. A simple way of dealing with this is to take the average of the two forecasts/fits. Don't worry too much that you get different results - there is a lot of uncertainty in this kind of "alternative history" in any case.

In either case, your models should be able to capture the main drivers in your time series.

• Daily data usually has intra-weekly seasonality, but your manager is likely not interested in a particular Tuesday but in aggregate results, so you could probably just disregard this one seasonality.
• However, you also write that you have "quarterly" seasonality, which one could interpret in two ways: either your daily data have a pattern that repeats every three months, or you have a pattern that recurs on a yearly basis, with different quarters being noticeably different. In any case, you can capture the effect by transforming the day-of-year using sine and cosine waves (Fourier terms). Don't, e.g., use dummy coding for the quarter - this will yield a step function that simply does not make sense. You may want to take a look at our tag.
• If you have promotions, you could include them in the model and also include when you would have run promotions in the absence of COVID. Yes, this adds some degree of arbitrariness. Alternatively, don't model promotions and live with the fact that your demand is smoothed out. As for the day of week pattern mentioned above, your manager is likely not interested in this.

What is the broad area of study or technique that deals with the above problem?

You already have the actual sales.

The second thing that you need are the expected sales. That can be found using time series forecasting.

Also noteworthy to mention is some details about the statistical lingo. Expected refers to something more specific:

• Expected value: The average outcome of a random variable.

For example, a six sided dice roll has an expectation value of $$\frac{1}{6}+\frac{2}{6}+\frac{3}{6}+\frac{4}{6}+\frac{5}{6}+\frac{6}{6} = 3.5$$

• Estimated value: Some estimate of a value related to a population.

For example when we have a small sample than we can use the properties of that sample to estimate the properties of the population. Any values computed from the sample are not necessarily equal to the related actual values of the population, but are probably close to it.

• Predicted value: An estimate that is some sort of extrapolation.

Based on samples from a population given certain settings, we make an estimate of the population given different settings.

For example when we have a set of samples/observations in the past, we might extrapolate some trend line to the future.

You seem to be looking for a 'predicted value' of the covid-time sales based on the pre-covid-time sales.