# Scalar-on-Function Relative Error Regression for Weak Dependent Case
## 5 Computational Study
### A Real Data Application  
We devote this paragraph to the real application of the RE-regression as a predictor. Our ambition is to emphasize the robustness of this new regression. To do this, we compared it to the classical regression defined by the conditional expectation. For this purpose, we considered physics data corresponding to the monthly number of sunspots in the years 1749-2021. These data were available at the website of WDC-SILSO, Royal Observatory of Belgium, Brussels, [[http://www.sidc.be](http://www.sidc.be)]([http://www.sidc.be](http://www.sidc.be)) (accessed on 1 April 2023). The prediction of sunspots is very useful in real life. It can be used to forecast the space weather, assess the state of the ionosphere, and define the appropriate conditions of radio shortwave propagation or satellite communications. It is worth noting that these kinds of data can be viewed as a continuous time process, which is the principal source of a Hilbertian time series by cutting the continuous trajectory into small intervals with fixed larger intervals. To fix these ideas, we plotted the initial data in Figure 3.  
To predict the value of a sunspot in the future, given its past observations in a continuous path, we use \(\left(Z_{t}\right)_{t\in[0,b)}\) the whole data set, as a real-valued process in continuous time. We then constructed, from \(Z_{t}\), \(n\) Hilbertian variables \(\left(X_{i}\right)_{i=1,\ldots,n}\), where  
\[\forall t\in[0,b),\qquad X_{i}(t)=Z_{n^{-1}((i-1)b+t)},\qquad Y_{i}=X_{i}(b).\]  
Thus, our objective was to predict \(Y_{n}\), knowing \(\left(X_{i},Y_{i}\right)_{i=1,\ldots,n-1}\) and \(X_{n}\). At this stage, \(\widetilde{R}(X_{n})\) was the predictor of \(Y_{n}\). In this computational study, we aimed to forecast the sunspot number one year ahead, given the observation of the past years. Thus, we fixed on month \(j\) in 1,..., 12, and computed the estimator \(\widetilde{R}\) by the sample \(\left(Y_{i}^{j},X_{i}\right)_{i=1,\ldots 272}\), with \(Y_{i}^{j}\) as the sunspot number of \(j\)th months in the \((i+1)\)th year, and we repeated this estimation procedure for all \(j=1,\ldots,12\).  
As the main feature of the RE-regression is its insensitivity to the outliers, we examined this property by detecting the number of outliers in each prediction step \(j\). To do this, we used a MAD-Median rule (see [PERSON] and [PERSON] [20]). Specifically, the MAD-Median rule considers an observation \(Y_{i}\) as an outlier if  
\[\frac{|Y_{i}-M|}{\text{MAD}*0.6745}>C,\]  
where \(M\) and MAD are the medians of \(\left(Y_{i}\right)_{i}\), and \(\left(Y_{i}-M\right)_{i}\) respectively, and \(C=\sqrt{\chi^{2}_{0.975}}\) (with one degree of freedom). Table 1 summarizes the number of outliers for each step \(j\).  
Figure 2: Prediction results.  
Both estimators \(\widetilde{R}\) and  
\[\widetilde{R}(x)=\frac{\sum_{i=1}^{n}Y_{i}K(h_{n}^{-1}\|x-X_{i}\|)}{\sum_{i=1}^{ n}K(h_{n}^{-1}\|x-X_{i}\|)}\]  
were simulated using the quadratic kernel \(K(x)\), where  
\[K(x)=\frac{3}{2}(1-x^{2})\mathds{1}_{[0,1]},\]  
and norm \(L^{2}\) was associated with the PCA-metric with \(m=3\). The cross-validation rule (7) is used to choose the smoothing parameter \(h\). Figure 4 shows the prediction results, where we drew two curves showing the predicted values (the dashed curve for the relative regression and the point curve for the classical regression) and the observed values (solid curve).  
Figure 4 shows that \(\widetilde{R}\) performed better in terms of the prediction results compared to \(\widehat{R}\). Even though both predictors had good behavior, the ASE of the relative regression (2.09) was smaller than the classical regression, which was equal to 2.87.  
\begin{table}
\begin{tabular}{|l|c c c c c c c c c c c c|} \hline Months & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ \hline Outliers & 15 & 26 & 13 & 5 & 24 & 25 & 7 & 9 & 11 & 8 & 9 & 15 \\ \hline \end{tabular}
\end{table}
Table 1: Number of outliers with respect to \(j\).  
Figure 3: Initial data.