I am trying to predict the price of a flight ticket based on different variables. The variables are: Time of Day, Day of week, Month, Booking time (How many days before departure the ticket is booked)... The idea is to do a multiple linear regression. I would like to group the months into high, low and shoulder season.

I was wondering if I should group the months before or after the regression analysis and how should I decide on which month belongs to which season?


1 Answer 1


This is a common situation, but not straightforward to solve in my opinion. I agree with the comment below, that if you start grouping things based on analysis, you are ignoring uncertainty. For example, if you group May and April together, but your estimate for both is quite uncertain, then this grouping may not be valid at all, especially for different years.

Answer, ignoring problems;

You can group after the first regression based on the coefficients for each month. Put similar coefficients together. If you have prior knowledge, you can group the months together based on that, but other than that, I think a regression would be the simplest way to figure out a good grouping.

Two other remarks:

  • Not really your question, but, either way, this will actually create situations where your predictions drop or rise very suddenly when the month changes. If this is not realistic, you can look at including something like seasonal splines (see http://www.fromthebottomoftheheap.net/2014/05/09/modelling-seasonal-data-with-gam/).
  • Probably a better and more satisfying answer can be given if you are a bit more clear about your modelling purposes, ie. what do you want with it, and why do you take these predictors, and why do you want to group the months like this?
  • $\begingroup$ I dont think this is a good idea. It, for example, ignores the differences in uncertainty of the various parameter estimates for months. I dont think an answer can be given without understanding why the op wants to do this. $\endgroup$ Aug 23, 2017 at 14:20
  • $\begingroup$ Okay, I can get into that. I was kind of halfway between answering the question and improving what the OP wants. $\endgroup$
    – Gijs
    Aug 23, 2017 at 14:42
  • $\begingroup$ I feel bad for the downvote, a comment would have been sufficient, but I cannot remove it unless the answer is edited. $\endgroup$ Aug 23, 2017 at 15:36
  • $\begingroup$ Haha, well, I'll change something, and include a warning. $\endgroup$
    – Gijs
    Aug 27, 2017 at 19:33

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.