## 4 Development and Simulation of a Predictive S&OP Methodology
### Statistical Treatment of Demand for a Defined Case Study
#### 4.2.2 Statistical Treatment
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Coefficients** & **Estimates** & \(p\)**-Value** \\ \hline \(a_{0}\) & 33.3482 & 0.000 \\ \(a_{1}\) & 3.9847 & 0.000 \\ \(b_{1}\) & 19.3899 & 0.000 \\ \(a_{2}\) & 0.2741 & 0.198 \\ \(b_{2}\) & \(-0.0055\) & 0.979 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: S\({}_{2}\) harmonic regression coefficients. From the results, it is concluded that only \(a_{0},a_{1}\), and \(b_{1}\) are significant (\(p\)-value \(<\) 0.05) unlike the higher order harmonics since their \(p\)-values are higher than 0.05. As a result, the residuals cannot be considered white noise, since there is a correlation between their values. Thus, the presumption of randomness here is not fulfilled, so the model is not adequate. This situation is explained by the fact that the period is not constant throughout the series, as reflected in Figure 11, which shows the adjusted series and the period compared to the original data. *Autoregressive integrated moving average (ARIMA):** An autoregressive model and moving averages of order \(p\) and \(q\); _ARIMA_ (\(p\), \(q\)):  
\[y_{t}=\varphi_{1}y_{t-1}+\ldots+\ \varphi_{p}y_{t-p}+a_{t}+\theta_{1}a_{t-1}+ \ldots+\ \theta_{q}a_{t-q} \tag{5}\]  
where \(\varphi\) and \(\theta\) are constants different from zero that show the weight of past observations and the errors in estimating future values of the series. By running the algorithm to determine the autoregression coefficients (auto.arima) in R Studio, an autoregressive (AR) (4) model, with four as the order \(p\) representing the number of previous values considered, can be obtained and its coefficients are shown in Table 4.  
The model is still not adequate since non-random behavior is observed among the model residuals, as shown in Figure 12. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(\varphi_{1}\) & \(\varphi_{2}\) & \(\varphi_{3}\) & \(\varphi_{4}\) & Mean \\ \hline
0.4743 & 0.2439 & 0.1682 & 0.0916 & 33.4616 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Autoregressive integrated moving average (ARIMA) correlation coefficients (4, 0, 0). Figure 11: Theoretical series versus the real series and the fundamental frequency (own elaboration). Legend: black line = original data series; green line = harmonic series; vertical black line = periods. Figure 12: Autoregressive (AR) (4) residual model (own elaboration). Artificial neural networks (ARNNs) (p, P, k) m: Autoregressive neural networks (ARNNs) are used to determine the most appropriate parameters for the model and if there is a model that better fits the data. [PERSON] and [PERSON] [44] were the first to use a neural network for prediction purposes by applying a feedforward multilayer network. The autoregressive neural network model ARNN (p, P, k) m is equivalent to an ARIMA model (p, 0, 0) (P, 0, 0)m, where m is the seasonal component of the series, and k is the number of neurons in the hidden layer. The result achieved is an ARNN (25, 13, 1), which translates into an AR (25) with a component 13 to ensure seasonality, and a neuron is used in the hidden layer, which is equivalent to an ARIMA (25, 0, 0) (13, 0, 0)\({}_{1}\). Likewise, a normality test is performed to determine if this layer corresponds to Gaussian noise (Shapiro-Wilks test (\(p\)-value = 0.7856) at \(\sim\)N (0, 2.71)). This methodology confirms the results initially collected in the ACF (Auto Correlation function) and PACF (Partial Auto Correlation function) correlograms. Likewise, the absence of autocorrelations and dependence of the residuals are confirmed through the ACF correlogram in Figure 13, which is why it is concluded that this layer is Gaussian white noise:  
The model presents 25 correlation coefficients and a mean for the calculations. The greater complexity of the model compensates for the lower errors in the model and the Gaussian white noise in the residuals. Table 5 shows the predictions of the values (13) and the confidence intervals (CI) for 80% and 95% of the predictions.