## 3 Methodology
### Testing and Relaxing the Classical Assumptions
#### 3.3.5 Diagnostics of the Homoscedasticity Assumption
The difficult part is how to identify the function \(V\Big{[}\epsilon\big{|}\overrightarrow{x}\Big{]}=f\Big{(}\overrightarrow{x }\Big{)}\) that will produce the weights, \(w_{i}\), for \(i\) = 1, 2, \(\ldots,n\). Let us construct an OLS regression model (14) using the dataset. We can calculate the OLS residuals (\(e_{i}\), for \(i\) = 1, 2, \(\ldots,\) 126) according to (15). From there the predicted residuals (\(e_{i,HO}\), for \(i\) = 1, 2, \(\ldots,\) 126) can be assessed according to (21). The variance of the error variable for the \(i\)-th record in the dataset \(\left\langle\overrightarrow{x}_{i},y_{i}\right\rangle\) is not known, however both the squared OLS residual, (\(e_{i}\))\({}^{2}\) and the squared predicted residual (\(e_{i,HO}\))\({}^{2}\) can be used as proxy variables for that unknown variance. Let us regress the r.v. \"absolute predicted residual value\", \(E_{HO}\) from the OLS model (5) on the \(p\)-regressors (4):  
\[E_{HO}=\sum_{j=1}^{p}\beta_{j}^{e}X_{j}+u \tag{39}\]Here, \(u\) is the error variable of the regression. We will construct the point estimate, \(\overset{\rightarrow}{b}^{e}=\left(b_{1}^{e},b_{2}^{e},\ldots,b_{p}^{e}\right)^{T}\), of the unknown parameter vector \(\overset{\rightarrow}{\beta}^{e}=\left(\beta_{1}^{e},\beta_{2}^{e},\ldots, \beta_{p}^{e}\right)^{T}\) using the training set \(\left\{\left\langle\overset{\rightarrow}{x}_{i},e_{i,H\O}\right\rangle\right\}\), for \(i=1,\,2,\,\ldots,\,126\). If we organize the predicted residuals into a 126-dimensional column vector, \(\overset{\rightarrow}{e}_{H\O}=\left(e_{1,H\O},e_{2,H\O},\ldots,e_{3,H\O} \right)^{T}\), then we can plug it instead of \(\overset{\rightarrow}{y}\) in (27) to obtain:  
\[\overset{\rightarrow}{b}^{e}=\sum_{ \begin{array}{c}j=1\\ s_{j}^{cor}>0\end{array} }^{p}\frac{\overset{\rightarrow}{u_{j}}^{T}\overset{ \rightarrow}{e}_{H\O}}{s_{j}^{cor}}\overset{\rightarrow}{v}_{j} \tag{40}\]  
Plugging the point estimate of the parameter vector into (39), we can obtain the regression model which predicts the \"absolute predicted residual value\" as a function of the vector of independent input \(\overset{\rightarrow}{x}=\left(K,B,d,D,\theta\right)^{T}\):  
\[\hat{e}_{H\O}\Big{(}\overset{\rightarrow}{x}\Big{)}\ =\sum_{j=1}^{p}b_{j}^{e}X_{j} (x_{1},x_{2},x_{3},x_{4},x_{5})\ =\sum_{j=1}^{p}b_{j}^{e}S_{j}(x_{1},x_{2},x_{3},x_{4},x_{5}) \tag{41}\]  
If the model (41) is not valid (e.g., according to the \(F\)-test), then there is not enough empirical proof to reject the homoscedasticity and we can use the constructed OLS regression model (14). If the model (41) is valid (e.g., according to the \(F\)-test) then the heteroscedasticity is proven. In case the explained variance of (41) is relatively small (e.g., its \(R_{adj}^{2}\) is less than 0.25), then we can claim that the heteroscedasticity is negligible and again we can use the constructed OLS regression model (14). Such a policy aligns well with the recommendation to correct for heteroscedasticity only when the problem is severe with maximal variance of the error variable at least 10 times bigger that the minimal variance [48]. An identical approach was successfully applied in [49; 50]. In case the explained variance of (41) is not negligible (e.g., its \(R_{adj}^{2}\) is at least 0.25), it is not advisable to use the constructed OLS regression model (14). Instead, we can use (41) as a proxy for the standard deviation of the error variable for the \(i^{\text{th}}\) record in the dataset \(\left\langle\overset{\rightarrow}{x}_{i},y_{i}\right\rangle\), so:  
\[\hat{\sigma}_{e,i}=\sqrt{V\Big{[}\epsilon\Big{|}\overset{\rightarrow}{x}_{i }\Big{]}}\approx\delta_{HO}\Big{(}\overset{\rightarrow}{x}_{i}\Big{)}=\sum_ {j=1}^{p}b_{j}^{e}X_{j}\Big{(}\overset{\rightarrow}{x}_{i}\Big{)}=\sum_{j=1}^ {p}b_{j}^{e}S_{j}\Big{(}\overset{\rightarrow}{x}_{i}\Big{)}=1/w_{i}\,,\text{ for }i=1,2,\ldots,n \tag{42}\]  
In (42), we identify the weights of the observation in the dataset. Therefore, we can build a WLS model (37) using (36) for prediction of the hydrodynamic efficiency of OWC WEC.