# Predictive Modeling of Urban Lake Water Quality Using Machine Learning: A 20-Year Study
## 2 Materials and Methods
### Data Collection
#### 2.2.1 Dataset Description  
The dataset used in this study comprises 252 monthly observations of seven water-quality parameters collected over 20 years (from January 2000 to December 2020) from an urban lake. The water-quality parameters include Dissolved Oxygen (DO), Biological Oxygen Demand (BOD), pH, Turbidity, Nitrate, and Phosphate (Table 1, Figures 1 and 2).  
\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline
**Parameter** & **Mean** & **Median** & **Min** & **Max** & **Sid. Deviation** & **Skewness** & **Kurtosis** \\ \hline — & — & — & — & — & — & — & — & — \\ \hline DO & 8.5 & 8.6 & 4.3 & 12.7 & 1.8 & \(-\)0.2 & 2.8 \\ \hline BOD & 3.7 & 3.5 & 1.0 & 6.5 & 1.1 & 0.5 & 3.1 \\ \hline pH & 7.2 & 7.2 & 6.5 & 8.0 & 0.3 & \(-\)0.1 & 2.6 \\ \hline Turbidity & 15.2 & 14.8 & 5.0 & 25.0 & 4.2 & 0.3 & 2.9 \\ \hline Nitrate & 0.7 & 0.6 & 0.2 & 1.5 & 0.3 & 0.6 & 3.4 \\ \hline Phosphate & 0.05 & 0.05 & 0.01 & 0.1 & 0.02 & 0.4 & 2.7 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Descriptive statistics of dataset.  
Figure 1: Time series of water-quality indices.  
Figure 2: Correlation matrix.  
Composition  
The dataset is a multivariate time-series dataset, with each of the seven water-quality parameters serving as a variable. Each observation includes the month and year of data collection, and the corresponding values for the seven parameters.  
Normality  
Preliminary examination of the dataset indicated that all the variables do not strictly follow a normal distribution. Skewness and kurtosis tests confirmed the departure from normality. This is not unexpected in environmental data due to the influence of numerous uncontrollable factors.  
Seasonality  
Seasonal decomposition of the dataset revealed clear patterns of seasonality in some parameters. For example, BOD levels and Turbidity tended to increase during the rainy months, likely due to increased runoff from the urban catchment area. In contrast, DO levels showed an opposite trend, decreasing during rainy months, likely due to higher water temperatures and increased organic load.  
Collinearity  
Correlation analysis was performed to detect any collinearity among the variables. High correlation was observed between BOD and Nitrate, and between Turbidity and Phosphate. These correlations could be due to common sources or similar processes affecting these parameters.  
Variance  
An analysis of variance revealed heteroscedasticity in the dataset, with the variability of parameters like Turbidity and BOD increasing over time. This could reflect the increasing anthropogenic impact on the lake due to urbanization over the two-decade period.  
In our data preprocessing phase, we assessed the normality of our dataset. It is essential to note that, while we examined the distribution of our data, the primary concern for models like Multiple Linear Regression (MLR) is the normality of the residuals. Our analysis ensured that the assumptions pertinent to each model, especially the normality of residuals for MLR, were adequately met.  
Collinearity among predictors was thoroughly evaluated using correlation matrices. Recognizing the potential impact of collinearity on model stability and interpretability, we employed techniques such as Principal Component Analysis (PCA) for dimensionality reduction. Additionally, based on domain knowledge, we considered removing or combining certain highly correlated variables. To further ensure the robustness of our models, we also utilized the Variance Inflation Factor (VIF) as a metric to detect and address multicollinearity.