# Demand Forecasting Model for Airline Flights Based on Historical Passenger Flow Data
## 2 Materials and Methods
### Algorithm for Medium-Term Flight Demand Forecasting  
A three-stage approach to constructing the demand forecast is proposed at the conceptual level for model development. At the first stage, it is proposed to use historical data pertaining to airline flights over the past three years. This dataset encompasses information such as the date and time of departure, aircraft type, passenger traffic, load percentage, and other relevant details. The data should be subjected to analysis based on the demand training sample collected in order to ascertain the structure of the data as well as to determine some initial forecasting parameters (trend, seasonal index, etc.) [30]. The estimation of demand is based on the flight departure time and the number of passengers carried, which is taken as the final demand for the flight. In the construction of a forecast, it is of great importance to estimate demand at three levels of seasonality: annual, monthly, and weekly. This is due to the fact that demand for air travel is influenced by different factors, which manifest themselves in different time cycles [31]. The subsequent stage entails the examination of the influence of external elements through the utilization of multiple regression models. In this approach, the dependent variable is passenger demand, while the independent variables encompass external economic factors. It is assumed that demand-side factors should be taken into account in relation to the region of flight departure and arrival points. This is because the aggregate demand for a flight is contingent upon the characteristics of the start and end nodes of the flight [32]. The final stage of modeling entails the calibration of the obtained medium-term demand forecast, with due consideration of the overlapping functional dependencies of demand on external factors identified at the second stage. The final demand estimation is represented by the following dependence (see Equation (1)). \[D(t)\ =\ D_{0}*f_{1}(t)*f_{2}(t)*f_{3}(t)*f_{external}(t), \tag{1}\]  
where \(D(t)\) is the distribution of predicted demand by hour, \(D_{0}\) is the forecast demand without taking into account seasonality, \(f_{external}(t)\) is the factor of influence of external economic parameters, \(t\) is the time of flight setting, \(f_{1}(t),f_{2}(t)\), and \(f_{3}(t)\) are the factors of seasonality by year, week, and day of the week, respectively (see Equations (2)-(4)). \[f_{1}(t)\ =\ 1+k_{m}, \tag{2}\]  
where \(k_{m}\) is the coefficient of seasonality by month. \[f_{2}(t)\ =\ \sqrt{((1+w_{1}*k_{w})*(1+w_{2}*\overline{k_{w}}))}, \tag{3}\]  
\[f_{3}(t)\ =\ \sqrt{((1+w_{1}*k_{h})*(1+w_{2}*\overline{k_{h}}))}, \tag{4}\]  
where \(w_{1},w_{2}\) are the weights of the RMS smoothing function, \(k_{w}\) is the seasonality coefficient by week, and \(k_{h}\) is the seasonality coefficient by hour in a day. If the first or second multiplier takes negative values (see Equations (3) and (4)), then only the second multiplier is taken with a weighting factor of one and no square root (see Equations (5) and (6)). \[f_{2}(t)\ =\ 1+\overline{k_{w}}, \tag{5}\]\[f_{3}(t)\ =\ 1+\overline{k_{h}}, \tag{6}\]  
In the absence of sufficient historical data on flight destinations, it is proposed that the method of analogy be employed to forecast demand. In such instances, the demand for a flight for which there is insufficient data is assumed to be equal to the demand for the most similar destination in terms of external economic parameters. The issue is addressed by grouping comparable destinations and selecting the nearest destination through the implementation of the \(k\)-means clustering algorithm [33]. The algorithmic process for constructing a medium-term forecast of flight demand by air travel destination is illustrated in Figure 1.  
The three-stage algorithm represents a structured approach to demand forecasting, consisting of sequential stages, each aimed at addressing a specific task--from data preparation to obtaining forecast values for the selected forecasting horizon.