# Forecasting the number of visitors in each hotel in a city

I am looking for some suggestion on what a good approach would be for the following forecasting problem.

Problem statement: There are 100 hotels in a city and I have the monthly data on the total number of guests who stayed in the hotel for the past three years i.e. 36 data points for each of the 100 hotels. Using this data, I need to build a forecasting model to predict the number of visitors for the next 1 month for each hotel.

Some of questions I have are:

1. That hotels are competing against each other for visitors. So if the total number of visitors to a city remains roughly the same in a month then an increase in the number of visitors in one hotel should lead to a decrease in the number of visitors in another hotel. What kind of a time-series or any other model will take this into account?

2. In general what are some of the best practices for multi-category forecasting (in this example since we want to forecast for each, therefore each hotel can be considered as a category)

According to point 1. : The factor that is completely ignored is that the price from other (neighbouring) towns could also be relevant. From an observer's perspective, I am therefore not sure whether the number of visitors should be assumed to be fixed. A price dercrease in a hotel could attract new visitors in a city!

If the stable number of visitors is an important factor it might also be helpful to change the target variable and introduces a two step forcasting process. You could calculate the share of all visitors in a hotel per month and try to forecast it. Only market shares would be considered here. To multiply this then with the number of visitors would result in the actual desired size. However, the total number of visitors would also have to be forecast, which does not make it any easier.

You could also tackle this problem by some kind of competition feature, e.g. the relative market position of hotel x in comparison to other hotels.

According to point 2. : Why can't you just predict each hotel individually? I don't see any need to model this extra. You put the features of Hotel X for the next month into the model and get a single forecast. Could this be repeated for all hotels?

• A valid point regarding prices but since we do not have this data so we will in this case limit our solution to available data. Regarding the point 2, we could build a model for each hotel if we have only a few hotels. But when you have hundreds of hotels, building a separate model for each hotel is not practical from availability and maintenance point of view. Jan 8 '19 at 9:31

In essence, you are trying to predict by category, along with the fact that the prediction for the next month would take into account both fixed and random effects, i.e. effects that are inherent to hotel prices themselves, and that also externally influence what you are trying to measure, e.g. time.

In this regard, your model might be best served by employing a multilevel model. This can be done using the lme4 library in R.

As a separate example, suppose we wish to determine whether school attended has a distinct effect on grade achieved by a student. In this regard, a multilevel model would model the following as such:

library(lme4)
library(mlmRev)
exam<-data.frame(Exam)
exam

lmer(normexam ~ 1 + (1 | school), data=Exam)


The output is as follows:

> lmer(normexam ~ 1 + (1 | school), data=Exam)
Linear mixed model fit by REML ['lmerMod']
Formula: normexam ~ 1 + (1 | school)
Data: Exam
REML criterion at convergence: 11014.65
Random effects:
Groups   Name        Std.Dev.
school   (Intercept) 0.4142
Residual             0.9207
Number of obs: 4059, groups:  school, 65
Fixed Effects:
(Intercept)
-0.01325


In this case, we can see that depending on the school in question, there is a negative fixed effect present in this instance.

Suppose you are attempting to measure certain effects on hotel prices, e.g.

lmer(hotelprice ~ 1 + (1 | starrating), data=mydata)


From this, you could make a prediction by category through examining the effect of the fixed and random effects by category, or by hotel in this instance.

That said, do ensure that you have sufficient observations if each hotel is being considered a category. If not, then you might want to consider defining the category in other ways, e.g. X number of hotels with a certain star rating, a certain price range, etc.