Simple and multiple linear regression analysis for rainwater quality checking

Dr. Soumen Atta, Ph.D.
8 min readMar 7, 2023
Photo by michael podger on Unsplash

In this tutorial, we will provide a step-by-step guide on how to perform Simple Linear Regression (SLR) and Multiple Linear Regression (MLR) for rainwater quality analysis using Python.

Introduction

Rainwater is an important natural resource, and its quality can have significant impacts on human health and the environment. In order to analyze the quality of rainwater, it is often useful to use statistical models to understand the relationship between different variables. Simple linear regression (SLR) and multiple linear regression (MLR) are two commonly used techniques for this purpose.

In this tutorial, we will provide a step-by-step guide on how to perform SLR and MLR for rainwater quality analysis using Python.

Dataset

Here, we will use an artificial dataset. We will create this dataset for this tutorial. Note that this dataset is randomly created. The Python code to generate such a dataset is given below:

import pandas as pd
import random

# create an example dataset with 250 entries
data = {
'pH': [random.uniform(6, 8) for i in range(250)],
'Conductivity': [random.randint(100, 1000) for i in range(250)],
'Temperature': [random.randint(20, 30) for i in…

--

--

Dr. Soumen Atta, Ph.D.

Assistant Professor, Center for Information Technologies and Applied Mathematics, School of Engineering and Management, University of Nova Gorica, Slovenia