# Water Quality Evaluation and Analysis by Integrating Statistical and Machine Learning Approaches
## 4 Results and Discussion
### Principal Component Analysis (PCA) Results  
The relationship between the number of principal components and the cumulative explained variance is shown in Figure 12. The cumulative explained variance increases rapidly for the first four principal components, indicating that these components capture a significant portion of the variability in the dataset. This dataset comprises six water quality parameters: pH, DO, COD, BOD, TSS, and AN. However, PCA analysis reveals that not all parameters contribute equally to the total variance. The first four components capture most of the information, while the fifth and sixth component contribute negligibly to the cumulative variance. This is why the number of primary components needed to explain 95% of the variance is four rather than six. The horizontal dashed red line at 95% cumulative variance demonstrates that the first four components sufficiently represent the dataset, ensuring dimensionality reduction without significant information loss. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Metric** & **Mean** & **95\% CI Lower** & **95\% CI Upper** \\ \hline MAE & \(11.521\) & \(9.769\) & \(13.273\) \\ MSE & \(201.301\) & \(142.375\) & \(260.269\) \\ R\({}^{2}\) Score & \(-1.476\) & \(-2.989\) & \(-0.556\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Cross-validated regression metric (DTR). Figure 12: Cumulative explained variance by number of principal components. The blue dashed line represents the cumulative proportion of variance. The red dashed horizontal line indicates the threshold for the desired level of explained variance (95%) used to determine the optimal number of components. In addition to variance-based justification, the interpretability of the components is evaluated using a PCA loading matrix (Table 3), which shows the contributions of each variable to the first four principal components. For instance, PC1 has strong positive contributions from DO and BOD, reflecting their role in representing oxygenation dynamics. PC2 is influenced by COD and TSS, representing pollutant load, while PC4 has high loading from pH. This interpretable grouping supports the use of four components not only due to their statistical sufficiency, but also because they reveal distinct ecological or chemical processes. The intersection of the variance curve with this line highlights the minimum number of components required to achieve this threshold. The minimum number of components needed to obtain this amount of explained variance is indicated by the point where the curve initially meets this line. The significant initial rise in cumulative explained variance indicates that the dataset's information is primarily concentrated in the first main components. This suggests that these components encapsulate the essential aspects or fundamental patterns of the data, which are significant for the dataset's overall framework. The point at which the curve begins to stabilize, in conjunction with its intersection with the threshold line, signifies the effectiveness of dimensionality reduction. It highlights that beyond this threshold, additional components demonstrate diminishing utility in delivering new, significant information [50]. This suggests the inherent dimensionality of the dataset, indicating that it can be adequately represented with a reduced number of variables. Focusing on the optimal number of primary components can significantly enhance the efficiency of predictive models and other analyses. This deliberate reduction decreases unnecessary model complexity, thereby improving generalization in predicting performance when applied to new, unfamiliar data. Figure 13 illustrates the variance accounted for by each primary component, indicating a declining trend. The initial components account for a substantially greater proportion of the variance than the latter components. The graph illustrates a sequential rise in cumulative explained variance with the inclusion of each successive component.