Related Experiment Video
Updated: Aug 2, 2025

Watershed Planning within a Quantitative Scenario Analysis Framework
Published on: July 24, 2016
Water quality predictions through linear regression - A brute force algorithm approach
A C P Fernandes1, A R Fonseca2, F A L Pacheco3
1Centre for Natural Resources and Environment (CERENA/FEUP), Engineering Faculty, University of Porto, Rua Dr. Roberto Frias, Porto 4200-465, Portugal.
Abstract:
Linear regression is one of the oldest statistical modeling approaches. Still, it is a valuable tool, particularly when it is necessary to create forecast models with low sample sizes. When researchers use this method and have numerous potential regressors, choosing the group of regressors for a model that fulfills all the required assumptions can be challenging. In this sense, the authors developed an open-source Python script that automatically tests all the combinations of regressors under a brute-force approach. The output displays the best linear regression models, regarding the thresholds set by users for the required assumptions: statistical significance of the estimations, multicollinearity, error normality, and homoscedasticity. Further, the script allows the selection of linear regressions with regression coefficients according to the user's expectations. This script was tested with an environmental dataset to predict surface water quality parameters based on landscape metrics and contaminant loads. Among millions of possible combinations, less than 0.1 % of the regressor combinations fulfilled the requirements. The resulting combinations were also tested in geographically weighted regression, with similar results to linear regression. The model's performance was higher for pH and total nitrate and lower for total alkalinity and electrical conductivity.•A Python script was developed to find the best linear regressions within a dataset.•Output regressions are automatically selected based on regression coefficient expectations set by the user and the linear regression assumptions.•The algorithm was successfully validated through an environmental dataset.
Related Concept Videos
Testing Water Quality
Multiple Regression
Farmers can use multiple regression to determine the crop yield based on more than one factor, such as water availability, fertilizer, soil properties, etc. Here, the crop yield is the response or dependent variable as it depends on the other independent variables. The analysis requires the construction of a scatter plot...
Quality of Water
Residuals and Least-Squares Property
If the observed data point lies above the line, the residual is positive, and the line underestimates the actual data value for y. If the observed data point lies below the line, the residual is negative, and the line overestimates the actual data value for y.
The process of fitting the best-fit...
Typical Model Studies
Mechanistic Models: Compartment Models in Individual and Population Analysis

