9/21/2024

1

Introduction

In modeling groundwater flow using permeability as the key independent variable, it’s important to recognize that porosity and the hydraulic gradient also significantly impact flow rates. While permeability determines how easily water moves, porosity influences water storage, and the hydraulic gradient drives the flow. Although this model focuses on permeability, incorporating these additional factors would enhance accuracy and provide a more complete picture of groundwater dynamics.

Let us start from simple Linear regression equation: Flow Rate = β0 + β1 × Permeability + ϵ

where: β0 is the intercept, β1 is the slope (effect of permeability on flow rate), and ϵ is the error Component.

The objective of the analysis is to estimate the relationship between permeability and flow rate using random data.

Data Generation

# R code for data generation
# Set seed for reproducibility
set.seed(123)
# Generate random permeability and flow rate data
permeability <- runif(50, min = 0.01, max = 0.30)
flow_rate <- 1.5 * permeability + rnorm(50, mean = 0, sd = 0.2)
# Create data frame
data <- data.frame(permeability, flow_rate)

head(data, 5) # Display first few rows
  permeability  flow_rate
1   0.09339748 -0.1972424
2   0.23860849  0.5254701
3   0.12860331  0.2235796
4   0.26607505  0.1714852
5   0.28273551  0.6748663

3D Plotly Plot

library(plotly)
# Create 3D plot
fig <- plot_ly(data, x = ~permeability, y = ~flow_rate, 
     z = ~flow_rate, type = 'scatter3d', mode = 'markers') 
# Set axis labels
fig <- fig %>% 
  layout(scene = list(xaxis = list(title = 'Permeability'),
  yaxis = list(title = 'Flow Rate'),
  zaxis = list(title = 'Flow Rate')))
fig

Scatter ggPlot

library(ggplot2)
# Scatter plot of Flow Rate vs. Permeability
ggplot(data, aes(x = permeability, y = flow_rate)) +
  geom_point(color = 'blue') +
  labs(title = 'Flow Rate vs. Permeability', 
       x = 'Permeability', y = 'Flow Rate') +
  theme_minimal()

Fitted Scatter ggplot

library(ggplot2)
ggplot(data, aes(x = permeability, y = flow_rate)) +
  geom_point(color = 'blue') +
  geom_smooth(method = "lm", color = "red", se = FALSE) +
  labs(title = 'Flow Rate vs. Permeability with Regression Line', 
       x = 'Permeability', y = 'Flow Rate') +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'

Fit Simple Linear Regression model

# Fit linear regression model
model <- lm(flow_rate ~ permeability, data = data)
# Summary of the model
summary(model)
Call:
lm(formula = flow_rate ~ permeability, data = data)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.45116 -0.11157 -0.01313  0.10985  0.43723 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -0.03110    0.05719  -0.544    0.589    
permeability  1.76327    0.31482   5.601 1.01e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1881 on 48 degrees of freedom
Multiple R-squared:  0.3952,    Adjusted R-squared:  0.3826 
F-statistic: 31.37 on 1 and 48 DF,  p-value: 1.014e-06

Conclusion

The linear regression model estimates the relationship between permeability and flow rate. The equation derived from the model is:

Flow Rate = −0.031 + 1.763 × Permeability + 0.1881

Flow Rate = −0.031 + 1.763 × Permeability

where:

β0 = −0.031 is the intercept,

β1 = 1.763 is the coefficient for permeability.

ϵ = 0.1881 is is the error term.

The linear regression model shows a positive relationship between permeability and flow rate.

For each 1-unit increase in permeability, flow rate increases by 1.763 units.

While the intercept is not significant, the slope is highly significant (p < 0.001), indicating permeability is a strong predictor.

The R-squared value of 0.395 means that about 39.5% of the variability in flow rate is explained by the permeability variable, suggesting that while permeability is an important factor, other variables(such as porosity, hydraulic gradient) may also play a role in determining flow rate.

And the residual standard error of 0.188 indicates good prediction accuracy.

Overall, permeability significantly impacts groundwater flow.