3
$\begingroup$

I have a dataset with quarter wise revenue for past 3 years from Jan 2020 to Dec 2022. I have 4642 customers.

Each customer has 1 row of data which includes features based on his purchase frequency, avg revenue, total revenue, min revenue and max revenue etc for each quarter.

So, from Jan 2020 to Dec 2022, we have 12 quarters and data for all those quarters.

So, now our objective is to predict the revenue for 2023Q1.

As most of our customers have zero revenue, I use Zero Inflated regressor(ZIR).

So, I built a model with training set (2020Q1 to 2022Q3) and testing set (2022Q4).

But the training was done after some feature selection which resulted in omission certain quarter characteristics.

So, my important variables were Avg_revenue_2021_Q4, AVG_REVENUE_2022_Q2_trans_rate_2022_Q1, Total_revenue_2022Q3

So, now that model is built and validated, I get a R2 of 89% and 87% in train and test set respectively and decent MAE scores.

But my question, how do I predict the revenue for 2023Q1? 2023Q1 hasn't happened yet (and we need to predict in advance for the same).

So, should I build my final model by combining my train (2020Q1 to 2022Q3) and test (2022Q4)?

Once I build this final model, what is the input that I should pass to get predicted values for 2023Q1? there is no test set because 2023Q1 hasn't happened yet.

So, now to predict for 2023Q1 (for each of the 4642 customers), should I again pass the values of Avg_revenue_2021_Q4, AVG_REVENUE_2022_Q2, Total_revenue_2022Q3 ?

Or should I shift them by one quarter (and pass values for Avg_revenue_2022_Q1 and Avg_revenue_2022Q3) because our prediction is for one quarter later? (2023Q1)?

I know we could have used techniques like ARIMA etc but now that I have used ZIR, I would like to know how can we predict for the future quarter (next quarter).

$\endgroup$
2
  • $\begingroup$ Am I understanding correctly that you are interested in forecasting revenue for each customer separately (and not total revenue across all customers, which would probably be much easier)? $\endgroup$ Jan 4, 2023 at 10:42
  • $\begingroup$ Yes, am interested in forecasting revenue for each customer separately. I have past 12 quarters data (revenue and other purchase characteristics) for each customer.. $\endgroup$
    – The Great
    Jan 4, 2023 at 11:41

2 Answers 2

1
$\begingroup$

Quarterly revenue data often exhibits rather strong yearly seasonality, because customers tend to sign contracts near the end of a quarter to spend remaining budget in their business year (and salespeople know that, and customers know that their salesperson knows that, and all kind of fun games ensue).

It looks like your model has picked up on that: your most important predictors to predict 2022Q4 revenue are

  • Avg_revenue_2021_Q4 (so just the average revenue from exactly one year before - using this alone would be a "seasonal naive forecast", which is an extremely common simple benchmark for seasonal forecasting)
  • AVG_REVENUE_2022_Q2_trans_rate_2022_Q1 (I don't know what that one is)
  • Total_revenue_2022Q3 (just total revenue from the last observed quarter, which would again be an extremely common benchmark forecast, the "naive forecast")

To forecast the next quarter 2023Q1, I would now just take the model you have and feed in predictors shifted by one quarter:

  • Avg_revenue_2022_Q1 in place of Avg_revenue_2021_Q4 (so again, just the average revenue from exactly one year before, but of course now that is 2022Q1, since we are forecasting for 2023Q1)
  • AVG_REVENUE_2022_Q3_trans_rate_2022_Q2 in place of AVG_REVENUE_2022_Q2_trans_rate_2022_Q1 (shifting the predictor by one quarter, whatever that is)
  • Total_revenue_2022Q4 in place of Total_revenue_2022Q3 (again just total revenue from the last observed quarter before the one we want to forecast for)

Now, if you want to forecast out more than one quarter, e.g., for 2023Q2, you would need to feed in Total_revenue_2023Q1 in place of that last predictor. And you don't know that yet today. The most common approach would be to feed in the forecasted value which you obtained in the previous step. (Alternatively, you could build a separate model which forecasts two quarters ahead, using 2022Q4 as the training target, and only features up to 2022Q2 as training predictors.)

$\endgroup$
5
  • $\begingroup$ thanks for detailed answer. My first question. Isn't shifting the input variables by one (quarter) for predicting the immediate next quarter isn't a too simple approach and would it work? I also thought the same way but is this how it is done? Because the predictors we identified are for different target variables (2022Q4). So, shifting it by one quarter (for all predictors) will help us predict for 2023Q1 with similar performance? $\endgroup$
    – The Great
    Jan 4, 2023 at 11:50
  • $\begingroup$ My 2nd question. Do you think I can also make my training from 2020q1 to 2022q2 validate it on 2022q3 and finally test it on 2022q4 (which will give me 2023q1). Does this approach makes sense as well? $\endgroup$
    – The Great
    Jan 4, 2023 at 11:53
  • $\begingroup$ Regarding 1st question, let's say I wish to predict 2023Q3, then I should shift first two predictors by two quarters and for 3rd input feature, I should always put last observed value? $\endgroup$
    – The Great
    Jan 4, 2023 at 11:57
  • $\begingroup$ To your question on what is 2nd feature, it is a polynomial feature obtained by multiplying transaction rate for 2022q1 with average revenue for 2022q2 $\endgroup$
    – The Great
    Jan 4, 2023 at 11:58
  • $\begingroup$ Whether performance (accuracy) will be similar for one quarter as for another one depends on the data. What your model is telling you is that at least for forecasting for Q4, it makes sense to use a mixture of a seasonal naive, a naive and another model. It looks to me like you could use the same model for Q1, which would just entail shifting the predictors. Alternatively, you could learn a model on 2022Q1 and then apply it to forecast 2023Q1. $\endgroup$ Jan 8, 2023 at 15:25
1
$\begingroup$

Your question implies that you are forecasting for multiple customers simultaneously. If this is the case then you actually have longitudinal data - repeated observations of the same units (customers).

There are numerous different models for longitudinal data (e.g. fixed effects, random effects, mixed effects). Because your problem is forecasting rather that inference you should review the assumptions and data constraints, e.g. some estimators require complete data.

Finally, regarding your question of your test data: your training set should yield estimators, and you test these on your test data. Applying these to your forecast periods then gives you your forecast. Do not combine your test and training data - that will result in a different model.

However, you should also consider withholding a group of customers - you are modelling across customers and not just time.

$\endgroup$
5
  • $\begingroup$ Welcome to the forum. No, my data is cross-sectional. Meaning, each customer has only row (after aggregation). So, now that I have validated on 2022Q4. How do I predict for 2023Q1? What is the input should I pass to predict for 2023Q1? Any simple example please $\endgroup$
    – The Great
    Jan 3, 2023 at 9:54
  • $\begingroup$ my training yielded important features such as Avg_revenue_2021_Q4, AVG_REVENUE_2022_Q2, Total_revenue_2022Q3. $\endgroup$
    – The Great
    Jan 3, 2023 at 9:55
  • $\begingroup$ So, if I pass the input values for each of the above features (per customer), woudn't it be same as what I predicted for 2022Q4? How would it be for 2023Q1? $\endgroup$
    – The Great
    Jan 3, 2023 at 9:58
  • $\begingroup$ Can you please update your question to explain how many customers your are forecasting for? $\endgroup$ Jan 3, 2023 at 10:05
  • $\begingroup$ I updated the question. It is 4642 customers. Everyone of them have data only till 2022 Dec 31st. Now, we need to predict for 2023Q1 $\endgroup$
    – The Great
    Jan 3, 2023 at 11:39

Your Answer

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

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