Reduce Unexpected Aırlıne Dıverts: Modellıng wıth Tıme Serıes Analysıs

In this study, a decision support system was designed to minimize the costs caused by an airline's unexpected diverts. Meteorological data provided by an airline was used to predict visibility range, using the R programming language. The results of the analyzes are presented. It is aimed to make predictions by analyzing the data using time series analysis methods. Detailed forecasts were made to correspond to 3 forward-looking hours. The results obtained from time series analysis using AR, MA, ARMA, ARIMA, AutoARIMA and VAR were compared according to the error rate functions.


Introduction
Divert occurs when the airplane is landing on a different airport, rather than the planned destination published by the airline's timeline.Airplanes can be diverted for ight safety ( re / smoke, mechanical failure, natural disaster, security), operational conditions (fuel leak, weather condition at destination, runway failures), and service-related (medical, career criminal) reasons.Minimizing the number of unexpected diverts for an airline company plays an important role not only in reducing costs caused by this situation, but also preventing loss of reputation.For this reason, in case of a diverted ight, the purpose is to minimize costs faced by the airline company such as, shifting the ight timeline, providing new tickets to the passengers, fuel the airplane spends in the air and accommodation and health expenses of the passengers.Within the scope of this study, ights diverted due to the unfavorable weather conditions at the destination will be examined.In order to reduce the time and nancial resource losses that may arise as a result of the referrals, some weather data of the region where the aircraft landed is evaluated before the airplane leaves.
The report, which is published at regular intervals (half or one hour) determined by regional agreements and contains the weather condition data of the airport (visibility range, wind speed, wind angle, ceiling), is called the "Meteorological Terminal Air Report (METAR)" [1].
The weather forecast report published at certain intervals (usually 9 or 24 hours) for an airport, including meteorological events that are foreseen to be encountered in and around the airport is called" Terminal Aerodrome Forecast (TAF)" [1].
While "TAF" data is being examined; in the case of factors such as visibility range, wind speed, wind angle, and ceiling do not meet the restrictions accepted for safe landing, it is decided to take off / not to take off before ight or to land / not to land during the ight.Depending on this decision (TAF -METAR inconsistancy), a need for a decision support system has arised, which requires optimum decision making by using weather condition data analysis and weather forecasting methods.For this reason, a decision support system for this need is proposed in this study.
In the study, 84 divert reports, which occurred between the same dates, along with 130,000 lines of METAR and TAF data from domestic ights of an airline for Trabzon Airport, corresponding to the years 2010-2018, were provided by the airline company.
During the analysis of the compliance of METAR and TAF data, it was found that diverted ights were mostly due to the visibility range (90%) among the meteorological data provided.
The limit values used in programming are determined by the International Civil Aviation Organization (ICAO) according to some standards [1] set for the province of Trabzon.
METAR and TAF data for one of the 84 ights mentioned before are shown in Figure 1 as an example.Between 16.10.2011-19.10.2011, it was observed that there was a difference between METAR and TAF when the real values of the visibility range were compared with the forecast values.
In addition, it can be concluded that TAF data did not yield effective results in predicting sudden changes in visibility range that could affect the steering decision.

Figure 1. METAR-TAF compliance for a sample ight
Starting from TAF -METAR incompatibility, the time series method was used to predict sudden changes in visibility range and to make the decision of divert more e ciently.In the R programming language, forward-looking 6-step [2] TAF predictions were made using the following time series prediction methods: Autoregression (AR), Moving Avarage (MA), Autoregressive Moving Avarage (ARMA), Integrated Autoregressive Moving Avarage (ARIMA) and Vector Autoregression (VAR).Depending on the result of a using methods, error functions are compared.The values predicted are de ned as "Corrected TAF" (CTAF) to avoid confusion with the current TAF.
[1] Some standards determined by the International Civil Aviation Organization (ICAO) for Trabzon province, respectively; Visibility Range> 4593 m and Ceiling > 386 ft [2] The reason for the 6-step prediction in the future; From Trabzon to any point in Turkey are foreseen to go to the max 3 hours.
Considering that the METAR and TAF data used come every half an hour, a 6-step prediction is thought to be su cient for a ight.

Literature Review
There are many studies on the subject discussed in the literature.Within the scope of the study, the ones related to Time Series Analysis (TSA) were reviewed.Weather parameters such as weather condition data at a speci c station, minimum -maximum temperature, relative humidity were estimated using the properties calculated based on the correlation value in the weather condition data set at different time intervals.Regression equation coe cients were used to predict future weather conditions.The results obtained show that the MLR model can be used to predict the weather conditions.
In the study of Sfetsos (2000), a comparison of various estimation approaches on hourly average wind speed data is presented using time series analysis.In addition to traditional linear ARMA models and Arti cial Neural Networks, the model with the least errors was created with Adaptive Neural Network Based Fuzzy Inference System (ANFIS).
In Wu (2007) study, various forecasting directions related to wind speed and power are emphasized.Using the past time data (METAR), arti cial neural networks, which are an advanced and learning method, have been used in conjunction with Regression Analysis, which is the most basic estimation method to make TAF predictions.
In Yukubu and Gulumbe (2008) studies, seasonal modeling and estimation results for Sokoto monthly average temperature were obtained by using SARIMA approach.Five seasonal models were selected using the model selection criteria.The selected models have minimized the mean square error statistics of the forecasts in temperature prediction.
In Bahadır and Saraçlı's (2010) studies, temperature, precipitation and evaporation parameters were analyzed using the ARIMA (Box-Jenkins) model.As a result of their analysis, it has been concluded that for a next 5 years in Isparta, the city will go through a more humid period, the region will not be affected by global warming scenarios, and the drought will not be effective in the region.In their study, Lim and McAleer (2002) estimated the intrernational tourism for the period of 1990-1996, using the ARIMA models used in univariate time series analyzes, based on the tourist arrivals between 1975-1989.The estimates obtained that ARIMA model forecasts tourist arrivals from Singapore for the period 1990-1996 very well.
In the studies of Janiszewski and Wojtowicz (2014), the SARIMA model was used to estimate passenger tra c at Oslo Airport.The parameters of the selected model were estimated by the maximum likelihood method using GRETL software.It is concluded that the SARIMA model gives reasonable results and can be applied to estimate passenger tra c.
In their work, Radziukynas and Klementavicius (2014), they discussed the short-term estimation of wind speed for Lithuanian wind farm using the time series approach.Historical wind speed data (4 months) was applied to the ARIMA model and the forecast results were presented.Root mean square error (RMSE) and absolute error were used to calculate the accuracy of the estimates.In the studies of Medar et al. (2017), weather parameters were estimated using Data Mining, Regression Approaches and Arti cial Neural Networks methods, and the results were compared.In Kırbaş's (2016) study, the observation results of a meteorological station in April 2016 were compiled.The wind speed data obtained were analyzed by using statistical methods and arti cial neural networks.Forward wind speed estimation was made over the created time series.As a result of comparing the calculations and calculations with the real data, a distinct error rate difference was observed between the studied ARIMA models and arti cial neural networks, which featured the Arti cial Neural Network method.In the proposed study, detailed evaluations of frequently used forecasting methods were carried out at the 12-step level.

Methods
Thanks to the methods used in the literature, the methods used in the study are described in detail in the subtitles.

Time Series Analysis
The time series are sequences created by ordering the observation values for any event by time.Time series analysis, on the other hand, is a method that aims to model the stochastic process that gives the structure of the observed series about an event observed at certain time intervals and to make predictions about the future with the help of the observation values of the past periods.(Box and Jenkins, 1986).
Box-Jenkins describes a time series as a sequentially generated group observation (Box and Jenkins, 1976).Among the observed values of time series, situations such as increase, decrease or remain constant in certain periods can be observed.Such situations can have several causes.Investigating these changes is bene cial when it is desired to make predictions, that is, when predicting the future of time series data, because time series may show similar features in the future.These changes are the components of the time series; Trend, seasonal changes, cyclical and random changes are examined in four groups.
Although it is di cult to completely eliminate seasonal, cyclical or irregular uctuations, various methods are used for a certain level of smoothing.These methods will be discussed in the following sections.Flattening on the dataset used within the scope of the study was made for weekly, daily, hourly time zones and hourly attening was found to be the most suitable option for the dataset, considering that the actual data came every half hour.
Essentially, attening is to get rid of outliers without losing the trend of the data set.Accordingly, the attening process for the speci ed time periods has been applied to the data set in Figure 2 (the attening process has been applied to 130,000 data, and the attening process for the last 500 data is shown in Figure 2).
In cases where the time series is stationary, that is, the average, variance and covariance of the process do not change depending on time, suitable ones from the time series models are used.However, most of the time series are not stationary due to the characteristics of a particular stochastic process that changes over time.Time series are analyzed under two titles as stationary and non-stationary series according to the deviations shown on average.In order to apply the Box Jenkins method to non-stationary time series, it is necessary to eliminate the elements such as trend and seasonality, which disrupt the stability, with some conversion methods, thus making the series stationary (Pindyckand and Rubinfeld 1998).
Before performing a statistical analysis of a time series, it is necessary to investigate the stationarity of the process that created that series.The absence of a stochastic process makes the behavior of the series valid only for the period under consideration, and makes it di cult for us to generalize the series for other periods.For this reason, stagnation in time series is one of the most important features to be emphasized.In addition, the classical regression model was developed for use in the relationships between stationary variables, therefore it should not be used in non-stationary series (Gujarati, 2005: 709).
Since any of the explanatory variables in the regression equation is not stationary, the regression theory is disrupted, and stasis is actually a necessity.If the expected value, variance and covariance of a time series do not remain constant over time (if it changes depending on time), the series is not stationary.If the series is not stationary, analyzes are made only after it becomes stationary using various techniques.Many economic data (especially monetary data) are not stationary.
If a series is not stationary, the expected value or variance, or both, changes over time, only validates the behavior of the series for the estimated period under review.For this reason, it is very important to make a non-stationary time series stationary.A non-stationary time series is made stationary by applying one or more degrees of discrimination.

DETERMINATION OF STABILITY IN TIME SERIES
The methods used in the determination of stationarity are divided into two as classical and modern in the literature.
Classical methods make intuitive use of correlograms of graphs of series and autocorrelation (ACF) and partial autocorrelation (PACF) graphs to detect stability.
Modern methods include mathematical tests such as the Dickey Fuller Test.

DETERMINATION OF STABILITY WITH CLASSIC METHODS
In order to determine the stability with the graphic method, the graphics of the levels and differences of the series are examined, so that it can be determined whether there is a trend or seasonality in the series, and whether it is deterministic or random.
The correlogram is obtained by drawing autocorrelation (ACF) and partial autocorrelation (PACF) functions.

Autocorrelation Function (ACF)
The autocorrelation function (ACF) can be seen as an indicator of independence in a series, as it shows the correlation between observation values.Since it is not possible to fully de ne a stochastic process, the autocorrelation function that partially de nes the process has an important place in the model building process.The autocorrelation function gives the information of the degree of correlation between adjacent data points in an array.
The time series consisting of all delays and the original time series are drawn on the same graph, and with the help of this graphic, it is seen that the time series consisting of delays have the same structure as the original time series.In the next step, the values of the Autocorrelation coe cients are calculated.

Partial Autocorrelation Function (PACF)
Partial autocorrelation coe cient values of all delays constitute the partial autocorrelation function.In the time series analysis, the partial autocorrelation coe cient is used to determine to what degree the autoregressive model will continue.In other words, the partial correlation function refers to the relationship between lagged variables.

DETERMINATION OF STABILITY WITH MODERN METHODS
The data set used in the study is already stationary without any stabilization, as can be understood intuitively from the ACF and PACF graphics.However; as classical methods have been replaced by modern methods today, modern methods, which include various tests, are more reliable.Accordingly, while analyzing the data set stationarity, DF test was also used with the help of the R Programming language, although it is clearly seen that the data set is stationary in the correlograms.As a result, knowing that the data set we will analyze is stationary, modeling can be started.

Time Series Models
For any time series to be stationary, its mean, variance, covariance and higher-order moments must be constant over time.If the model is not stationary, the array must be stationed.(Box and Jenkins, 1976).Within the scope of the study, univariate-linear-stationary time series will be discussed.Time series models can be divided into three general classes.Autoregressive Process (AR) models were developed by Yule (1926Yule ( , 1927)), Moving Average (MA) models Slutsky (1937) and ARMA models Wold (1954) (Makridakis and Wheelwright, 1989).For each time series model listed below, the results of a ight selected from the diverted ight list will be presented as an example.
Accuracy and model results vary for other ights on the list; therefore, the example to be presented should not be considered as the representative of ights on the entire list.The selected ight is a ight that leaves at 20:20 on 18.10.2011and is directed due to low visibility range.Assuming that the METAR data recorded up to the ight time are known, the visibility range parameter will be predicted 6 steps ahead of the ight time, and the results will be presented in graphical format.The accuracy criteria and comparisons of the models established for all ights in the routing list will be included in the next sections.

Autoregressive Process Model -AR (p)
Autoregressive models (alternate-dependent models) can be de ned as models whose future values are estimated by using the past values of the time series.Many time series include this process (Enders, 2004).Under the title of autoregressive process models, the rst order AR model, AR (1), was used as the initial value.As an example, the view distance estimation results of the guided ight dated 18.10.2011with 20:20 departure time are presented in Figure 3.
In Figure 3, AR (1) model was applied and the last 500 of the 130.000 data set were visualized.In the graphic of the sample ight, the red line represents the actual data, the black line represents the tted values ( tted) according to the model, and the blue line indicates the forecast values.Forecasting for 6 forward steps is made in 85% and 95% con dence intervals.In the graph, although the AR (1) model tends to capture the actual data in the tting process, it is observed that it does not comply with the METAR data by displaying a linear behavior while predicting and cannot predict the sudden decrease of visibility range.

Moving Average Model -MA (q)
If the delayed error terms of a time series affect its current value, the moving average (MA) process is de ned.In other words, the estimated value of the variable in the moving average process is related to the estimated values of the error value (Enders, 2004).As an introduction to the moving average model, MA (1) model was chosen from the rst degree.The result graph of the sample ight can be seen in Figure 4.
When the chart above is analyzed, the MA (1) model tends to capture the actual data in the tting process; however, it can be concluded that he could not model the sudden decrease in visibility range in the forecast.Contrary to the sudden decrease in visibility range, it can be said that the MA (1) model has a much more optimistic prediction.
Autoregressive and Moving Average Model -ARMA (p, q) Most cases cannot be expressed by AR (p) or MA (q) processes alone.These series are expressed as the sum of autoregressive and moving average models.
If a time series has both AR and MA properties at the same time, this process is called Autoregressive and Moving Average (ARMA) process.AR (p), MA (q), ARMA (p, q) processes are based on the assumption that time series are stationary.Model results of ARMA (1,1) of the sample ight are presented in Figure 5.
When the graphic is examined, the ARMA (1,1) model tends to capture the actual data in tting, as in the AR (1) and MA (1) models; It can be said that it gives more realistic values than AR (1) and MA (1) models.The sudden visibility range decrease was estimated more accurately by ARMA (1,1) compared to AR (1) and MA (1) models.

Autoregressive Integrated Moving Average Model -ARIMA (p, d, q)
The basis of the Box Jenkins method used in the analysis of univariate time series is to explain the value of time series in any period with a linear combination of observation values and error terms of the same series in the previous period.Therefore, the mentioned method is also seen in the literature as Autoregressive Integrated Moving Average Method (ARIMA) (Özmen, 1986).
When applying ARIMA model, initial parameters were chosen as ARIMA (1,1,1).Model results can be found in Figure 6: As can be seen from the graphic showing the results of ARIMA (1,1,1) model, it appears that the ARIMA model tends to capture the actual data in the tting process as in the AR (1), MA (1) and ARMA (1,1) models.However, by estimating the sudden decrease of visibility range better than AR, MA and ARMA models; it has been observed that forecasts tend to catch the trend of actual data.
As can be seen from the graphic applied with the ARIMA (1,1,1) model, it can be said that the ARIMA model tends to capture the actual data in the tting process as in the AR (1), MA (1) and ARMA (1,1) models.However, by estimating the sudden decrease of view range better than AR, MA and ARMA models; it has been observed that forecasts tend to catch the trend of real data.AutoARIMA Model auto.ARIMA is an R function that returns the best ARIMA model based on AIC, AICc or BIC.The function ts the univariate time series best ARIMA model by performing a search between possible models within the speci ed constraints.(Montgomery et al., 2008).If there are more than one alternative model in a modeling process, there are multiple model selection criteria in the literature to choose the best one.The most common of these are AIC (Akaike Information Criterion) and SC (Scwarz Criterion) information criteria.According to these criteria, the best model is the model with the lowest numerical value according to AIC and SC values.(Grasa, 1989, Lutkepohl, 1991).AutoArima ts the best ARIMA model to the univariate time series.Returns the best ARIMA model based on AIC or BIC value.This function performs a search according to the possible model within the restrictions.That is, p, d, q values, auto, which are determined manually in ARIMA models.In Arima, all combinations are tried in the background by the program and given as the most optimized program output.
For the sample ight, the results of the ARIMA model (5,1,6) returned by the auto.ARIMA function are shown in Figure 7: When the graphic is examined, the ARIMA (5,1,6) model obtained as a result of the auto.ARIMA function; It seen that as in the AR (1), MA (1), ARMA (1,1) and ARIMA (1,1,1) models, it tends to capture the actual data in the tting process.The sudden decrease in visibility range is much better predicted than the aforementioned models; the tendency to capture the behavior of real data and model accuracy have increased signi cantly.
Vector Autoregressive Model -VAR () The Vector Autoregression (VAR) model is an extension of the autoregression model to multivariate time series data.In this model, all variables are considered intrinsic and a variable is de ned as a function of its own the lagged values of other variables in the model.
In Figure 8, the VAR model has been applied and the last 500 of the 130.000 data set have been visualized.The ones shown in red are real data, while the blacks show the tted data according to the VAR model algorithm.The line, colored in blue, shows the forecast data according to the VAR algorithm.Forecasting for 6 steps forward is made between 85% and 95% con dence intervals, as can be seen from the chart, the VAR model tends to capture real data in the tting process, as in the Ar and MA, ARMA and ARIMA models.In making predictions, it modeled the sudden visibility range decrease better than the AR, MA and ARMA and ARIMA models, and its success in capturing the trend of real data is much higher than the success of the ARIMA model, but since the AutoArima model and the VAR model results are close to each other, Error tests were used to nd out which model has higher success.

Results And Discussion
When VAR and AutoARIMA models are compared, it is observed that error rates of AutoARIMA model are lower at certain points.
After the determination of the most suitable model within the scope of the forecast of meteorological data, foresight tests are needed in order to use the model in foresight for the future.If the predictive power of a model becomes insigni cant, it cannot be used in future predictions (Çuhadar et al. 2009).Average Absolute Percentage Error (MAPE) statistic, Average Absolute Error (MAE) and Root Mean Square Error (RMSE) ratios were compared for AR, MA, ARMA, ARIMA, AutoARIMA and VAR models to perform prediction, veri cation and determine the predictive power of the model.As a result of comparison, when all error functions are examined, it is seen that error rates of AutoARIMA and VAR models are much lower than other models.

Error of Estimates Predicted by Models
There are many criteria that can be used to measure the accuracy of the predicted estimates.With the help of computer program (MATLAB), estimate calculations can be made at the desired con dence level.The model can be used to make a future prediction after determining, estimating, and testing for compliance.The aim is to obtain forecast values close to the future value.Here estimates should be produced to minimize error tests.The model that best ts the data should be tested by testing the future estimation success.Various criteria are used to measure predictive success: mean square error (MSE), root mean square error (RMSE), mean absolute percent error (MAPE), average percent error (MPE), etc.These criteria are desired to be as small as possible for the selection of the most successful forecasting model.MAPE, RMSE and MAE statistics calculated for AR, MA, ARMA, ARIMA, AutoARIMA and VAR models are given below.

Conclusion
In this study, meteorological data provided by an airline was used to predict visibility range, using the R programming language.According to results of the analysis, a decision support system was prefered to minimize the costs caused by an airline's unexpected diverts.The decision support system's aim is that make predictions by analyzing the data using time series analysis methods.Forecasts were made to correspond to 3 forward-looking hours of visibility range.
The results obtained from time series analysis using AR, MA, ARMA, ARIMA, AutoARIMA and VAR were compared according to the error rate functions.
As a result of comparing the error rates, the auto.ARIMA model was found to be more successful than the VAR model in predicting the visibility range.The confusion matrix is presented in Table 1.The purpose of the study; to reduce the number of diverted ights caused by low visibility range.It has been decided to y in cases where the visibility range is under 4593 m.Therefore, the number of ights overlapping the " ying" decisions of CTAF and METAR is important to us.The aim is not to remove the ight that will be diverted due to low visibility range.
The confusion matrix shows that for 84 ights diverted, 25 of them are prevented from being diverted by taking CTAF reference.The improvement rate in the percentage base is 30 percent.Since this ratio is not considered su cient, future studies will focus on modeling with ANNs.
Paras et al. (2012) explained a simple model for weather forecasting.The model used is multiple linear regression (MLR) model.
Agrawal et al. (2012) presented the Arti cial Neural Network model using MATLAB to estimate two important weather parameters (minimum and maximum temperature) in their studies.The model has been trained on 60 years of data (1901-1960) and tested on 40 years of data to forecast the minimum and maximum temperature.Results based on mean square errors (MSE) have shown that this model has a potential for successful application for weather forecast.In their study, Nury et al. (2013) used the ARIMA model to make short-term forecasts of monthly minimum and maximum temperatures in Syiret and Mouluibazar regions in Northeast Bangladesh.Between 1977-2011, the model was trained with the temperatures recorded at two stations in the Sylhet region, and veri ed on the period of 2010-2012.Using ARIMA models, forecasts of temperatures at 2 stations for 1 month after 2010-2011 were made.

Figures
Figures

Figure 1 METAR
Figure 1 METAR-TAF compliance for a sample ight

Figure 2 A 3 Page 10/ 13 AR ( 1 ) 4 MA ( 1 )
Figure 2 A Section From the Flattened Data Set 2.1: ACF and PACF graphs of the model