means and lagged variables to capture short-term
fluctuations and time dependence, respectively (Wu
& Coggeshall, 2012). It involved creating rolling
averages and lagged variables to capture short-term
fluctuations and temporal dependencies. Rolling
averages for temperature and fuel prices over a 7-day
window helped smooth out short-term noise and
highlight long-term trends. Lagged variables for
temperature, fuel prices, and markdowns were
created to capture both short-term and slightly longer-
term dependencies. In addition, a binary flag variable,
IsHoliday, was introduced to account for the effects
of holidays on sales patterns in this study. The
processed dataset now contains 22 fields, including
the original and preprocessed features. The processed
dataset will be trained with an 80:20 train-test split for
easy model evaluation. Figures 2, Figure 3 and Figure
4 illustrate the application of rolling averages and
lagged variables to smooth and capture the temporal
dependencies in the data. The codes of ARIMA
model and XGBoost are both from open-source files
on github (dmlc, 2021; Shukla, 2024).
2.2 ARIMA Combined GBM Model
2.2.1 Introduction of ARIMA
ARIMA is a well-proven statistical method widely
used in forecasting time series. The acronym stands
for AutoRegressive (AR) terms, integrated (I) terms,
and Moving Average (MA) terms combined in the
analysis of trends (Shukla, 2020). The AR part
models the variable on its own lagged values, the
integrated terms add differencing in the data to
achieve stationarity, and the MA part models the error
term as a linear combination of the error terms that
occurred contemporaneously and at various times in
the past (Shukla, 2020). As suggested by Shukla
(2020), ARIMA has been considered an appropriate
model in demand forecasting with a strong data trend
or seasonal pattern. For instance, in predicting the
level of retail sales, ARIMA can be fitted to historical
sales data showing apparent seasonal fluctuations
(Shukla, 2020). An ARIMA equation will compute
future behavioral models that correctly predict future
peaks and troughs in sales (Shukla, 2020). This
application in real life manifests the capacity of
ARIMA to model complex seasonal behaviors in time
series data; hence, it makes a very suitable choice for
this project, where historical sales data present a very
significant seasonal pattern because of holidays and
promotional activities. Through ARIMA, this study
could capture such temporal patterns, thus increasing
the accuracy of the short-term forecasts.
2.2.2 Introduction of GBM
XGBoost is a powerful machine learning technique
designed to scale and efficiently deal with large-scale
datasets and complex relationships in data. In this
setting, it forms an ensemble of weak learners—
usually decision trees—where each successive tree
tries to rectify the mistakes made by its predecessor.
As Chen and Guestrin point out, XGBoost provides
state-of-the-art results for a range of machine learning
problems in terms of scalability, efficiency, and the
ability to handle sparsity (Chen & Guestrin, 2016, p.
786). The dataset is also significant for nonlinear
interactions among features with broad predictors
considered in the case, such as temperature, fuel
prices, CPI, and markdowns. Moreover, XGBoost
allows insights into the importance of features, such
that one can identify the most important drivers of
demand and those that would guide strategic
decision-making. What makes it perfect for this
project is its proven performance in many
competitions and its ability to scale across distributed
environments, just as Chen and Guestrin had said—
strong and malleable (Chen & Guestrin, 2016).
2.2.3 Implementation Details
In this project, ARIMA and XGBoost are applied
complementarily to leverage their strengths. ARIMA
focuses on modeling the temporal dependencies of
sales data, representing seasonal trends and periodic
fluctuations. The model will work well on short-term
forecasts, where knowing past trends is very
important. XGBoost is utilized in the modeling of
complex interactions in a rich set of engineered
features against the target variable, using lagged
variables and rolling averages, along with holiday
flags. This builds on the flexibility and complexity of
the model that captures intricate patterns in the
driving of demand, thus leading to accuracy in
forecasting. Finally, this study tested the robustness
and the right prediction power of the models through
a solid validation strategy that includes cross-
validation and out-of-sample testing. Performance
measures showing the goodness of fit to the model are
Mean Absolute Error (MAE), Root Mean Square
Error (RMSE), and combined with residual analysis
to confirm the adequacy of the models. So, by
comparing those metrics, this project can determine
which model is more effective under different
scenarios and refine the approach accordingly.