1st step: Set data and take a knowledge for it

data3<-read.csv("karpur.csv")
karpur_data <- read.csv("karpur.csv")
str(data3)
## 'data.frame':    819 obs. of  15 variables:
##  $ depth        : num  5667 5668 5668 5668 5669 ...
##  $ caliper      : num  8.69 8.69 8.69 8.69 8.69 ...
##  $ ind.deep     : num  618 498 385 278 184 ...
##  $ ind.med      : num  570 419 300 205 131 ...
##  $ gamma        : num  98.8 90.6 78.1 66.2 59.8 ...
##  $ phi.N        : num  0.41 0.307 0.203 0.119 0.069 0.048 0.047 0.055 0.066 0.074 ...
##  $ R.deep       : num  1.62 2.01 2.6 3.59 5.44 ...
##  $ R.med        : num  1.75 2.38 3.33 4.87 7.62 ...
##  $ SP           : num  -56.6 -61.9 -55.9 -41.9 -34.9 ...
##  $ density.corr : num  -0.033 -0.067 -0.064 -0.053 -0.054 -0.058 -0.056 -0.046 -0.04 -0.043 ...
##  $ density      : num  2.21 2.04 1.89 1.79 1.76 ...
##  $ phi.core     : num  33.9 33.4 33.1 34.9 35.1 ...
##  $ k.core       : num  2443 3007 3370 2270 2531 ...
##  $ Facies       : chr  "F1" "F1" "F1" "F1" ...
##  $ phi.core.frac: num  0.339 0.334 0.331 0.349 0.351 ...
log10_permeability <- log10(karpur_data$k.core)

2nd step: Data Pre-processing:

data3$log_k_core <- log10(data3$k.core)

model 1: MLR of Permeability given all well logs without Facies —- Step 1: MLR of Permeability given all well logs without Facies —-

model1 <- lm(k.core ~ . - Facies , data = karpur_data)
summary(model1)
## 
## Call:
## lm(formula = k.core ~ . - Facies, data = karpur_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5549.5  -755.5  -178.1   578.0 11260.8 
## 
## Coefficients: (1 not defined because of singularities)
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   60762.728  16605.360   3.659 0.000269 ***
## depth            -7.398      1.446  -5.115 3.92e-07 ***
## caliper       -3955.952   1055.105  -3.749 0.000190 ***
## ind.deep        -14.183      2.345  -6.048 2.24e-09 ***
## ind.med          17.300      2.509   6.896 1.08e-11 ***
## gamma           -77.487      5.475 -14.153  < 2e-16 ***
## phi.N         -1784.704   1301.772  -1.371 0.170763    
## R.deep          -26.007      6.974  -3.729 0.000206 ***
## R.med            63.525      9.841   6.455 1.86e-10 ***
## SP               -8.784      3.460  -2.539 0.011313 *  
## density.corr   -523.060   5358.876  -0.098 0.922269    
## density        8011.106   1120.554   7.149 1.96e-12 ***
## phi.core        183.203     23.802   7.697 4.07e-14 ***
## phi.core.frac        NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1442 on 806 degrees of freedom
## Multiple R-squared:  0.5903, Adjusted R-squared:  0.5842 
## F-statistic: 96.77 on 12 and 806 DF,  p-value: < 2.2e-16
adjusted_r2_model1<- summary(model1)$adj.r.squared
rmse_model1 <- sqrt(mean(residuals(model1)^2))
cat("Adjusted R2:", adjusted_r2_model1, " | RMSE:", rmse_model1, "\n")
## Adjusted R2: 0.5841845  | RMSE: 1430.118

Plot measured vs. predicted permeability

predicted1 <- predict(model1, newdata = karpur_data)
plot(karpur_data$k.core, predicted1, xlab = "Measured Permeability", ylab = "Predicted Permeability",
     main = "Measured vs. Predicted Permeability (Model 1)")

—- Step 2: Stepwise Elimination (Model 1) —-

model2 <- step(model1 , direction = "both")
## Start:  AIC=11926.91
## k.core ~ (depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density.corr + density + phi.core + 
##     Facies + phi.core.frac) - Facies
## 
## 
## Step:  AIC=11926.91
## k.core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density.corr + density + phi.core
## 
##                Df Sum of Sq        RSS   AIC
## - density.corr  1     19799 1675068713 11925
## - phi.N         1   3906205 1678955118 11927
## <none>                      1675048914 11927
## - SP            1  13394190 1688443104 11931
## - R.deep        1  28897686 1703946599 11939
## - caliper       1  29214826 1704263740 11939
## - depth         1  54372650 1729421563 11951
## - ind.deep      1  76022788 1751071701 11961
## - R.med         1  86603706 1761652619 11966
## - ind.med       1  98823752 1773872666 11972
## - density       1 106221406 1781270319 11975
## - phi.core      1 123125117 1798174031 11983
## - gamma         1 416312526 2091361440 12107
## 
## Step:  AIC=11924.92
## k.core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density + phi.core
## 
##                Df Sum of Sq        RSS   AIC
## <none>                      1675068713 11925
## - phi.N         1   4564880 1679633593 11925
## + density.corr  1     19799 1675048914 11927
## - SP            1  13491079 1688559792 11930
## - R.deep        1  28896144 1703964857 11937
## - caliper       1  29253869 1704322581 11937
## - depth         1  54825159 1729893872 11949
## - ind.deep      1  77573926 1752642639 11960
## - R.med         1  86772220 1761840933 11964
## - ind.med       1 100740701 1775809413 11971
## - density       1 114209586 1789278299 11977
## - phi.core      1 124694278 1799762991 11982
## - gamma         1 417015194 2092083907 12105
adjusted_r2_step2 <- summary(model2)$adj.r.squared
rmse_step2 <- sqrt(mean(residuals(model2)^2))
cat("Adjusted R2:", adjusted_r2_step2, " | RMSE:", rmse_step2, "\n")
## Adjusted R2: 0.5846949  | RMSE: 1430.126

Plot measured vs. predicted permeability

predicted2 <- predict(model2, newdata = karpur_data)
plot(karpur_data$k.core, predicted2, xlab = "Measured Permeability", ylab = "Predicted Permeability",
     main = "Measured vs. Predicted Permeability (Model 2)")

—- Step 3: MLR of Permeability given all well logs with Facies —-

model3 <- lm(k.core ~ . , data = karpur_data)
adjusted_r2_model3 <- summary(model3)$adj.r.squared
rmse_model3 <- sqrt(mean(residuals(model3)^2))
cat("Adjusted R2:", adjusted_r2_model3, " | RMSE:", rmse_model3, "\n")
## Adjusted R2: 0.6814911  | RMSE: 1246.201

Plot measured vs. predicted permeability

predicted3 <- predict(model3, newdata = karpur_data)
plot(karpur_data$k.core, predicted3, xlab = "Measured Permeability", ylab = "Predicted Permeability",
     main = "Measured vs. Predicted Permeability (Model 3)")

—- Step 4: Stepwise Elimination (Model 3) —-

model4 <- step(model3, direction = "both")
## Start:  AIC=11715.43
## k.core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density.corr + density + phi.core + 
##     Facies + phi.core.frac
## 
## 
## Step:  AIC=11715.43
## k.core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density.corr + density + phi.core + 
##     Facies
## 
##                Df Sum of Sq        RSS   AIC
## - ind.deep      1     16793 1271937992 11713
## - ind.med       1    356746 1272277945 11714
## - density.corr  1    453661 1272374861 11714
## - phi.N         1   2953609 1274874809 11715
## - caliper       1   3063007 1274984206 11715
## <none>                      1271921199 11715
## - density       1   6217927 1278139127 11717
## - SP            1   8171834 1280093033 11719
## - R.deep        1  22117394 1294038593 11728
## - depth         1  36466976 1308388176 11737
## - R.med         1  61690461 1333611660 11752
## - gamma         1  92579723 1364500923 11771
## - phi.core      1 112793101 1384714301 11783
## - Facies        7 403127714 1675048914 11927
## 
## Step:  AIC=11713.44
## k.core ~ depth + caliper + ind.med + gamma + phi.N + R.deep + 
##     R.med + SP + density.corr + density + phi.core + Facies
## 
##                Df Sum of Sq        RSS   AIC
## - density.corr  1    437546 1272375538 11712
## - phi.N         1   2938766 1274876758 11713
## - caliper       1   3074396 1275012389 11713
## <none>                      1271937992 11713
## + ind.deep      1     16793 1271921199 11715
## - density       1   6228928 1278166920 11715
## - ind.med       1   6905855 1278843848 11716
## - SP            1   8191802 1280129794 11717
## - R.deep        1  22125695 1294063687 11726
## - depth         1  39139470 1311077462 11736
## - R.med         1  61773953 1333711946 11750
## - gamma         1  92865220 1364803212 11769
## - phi.core      1 112960440 1384898432 11781
## - Facies        7 479133709 1751071701 11961
## 
## Step:  AIC=11711.72
## k.core ~ depth + caliper + ind.med + gamma + phi.N + R.deep + 
##     R.med + SP + density + phi.core + Facies
## 
##                Df Sum of Sq        RSS   AIC
## - caliper       1   2980713 1275356252 11712
## <none>                      1272375538 11712
## - phi.N         1   3279032 1275654571 11712
## + density.corr  1    437546 1271937992 11713
## - density       1   5792837 1278168375 11713
## + ind.deep      1       677 1272374861 11714
## - ind.med       1   6813959 1279189497 11714
## - SP            1   8391302 1280766840 11715
## - R.deep        1  22009402 1294384940 11724
## - depth         1  38705776 1311081314 11734
## - R.med         1  61436819 1333812357 11748
## - gamma         1  93974329 1366349868 11768
## - phi.core      1 115336515 1387712053 11781
## - Facies        7 480267100 1752642639 11960
## 
## Step:  AIC=11711.64
## k.core ~ depth + ind.med + gamma + phi.N + R.deep + R.med + SP + 
##     density + phi.core + Facies
## 
##                Df Sum of Sq        RSS   AIC
## - phi.N         1   2534906 1277891157 11711
## <none>                      1275356252 11712
## + caliper       1   2980713 1272375538 11712
## + density.corr  1    343863 1275012389 11713
## + ind.deep      1      5597 1275350654 11714
## - density       1   7270311 1282626562 11714
## - SP            1   8733336 1284089587 11715
## - ind.med       1  12924050 1288280301 11718
## - R.deep        1  22449117 1297805369 11724
## - depth         1  51507476 1326863728 11742
## - R.med         1  60137982 1335494234 11747
## - phi.core      1 112564835 1387921086 11779
## - gamma         1 141535555 1416891807 11796
## - Facies        7 520094756 1795451008 11978
## 
## Step:  AIC=11711.26
## k.core ~ depth + ind.med + gamma + R.deep + R.med + SP + density + 
##     phi.core + Facies
## 
##                Df Sum of Sq        RSS   AIC
## <none>                      1277891157 11711
## + phi.N         1   2534906 1275356252 11712
## + caliper       1   2236587 1275654571 11712
## - density       1   5155969 1283047127 11713
## + density.corr  1    624807 1277266351 11713
## + ind.deep      1      1762 1277889395 11713
## - SP            1   8515796 1286406953 11715
## - ind.med       1  10944937 1288836095 11716
## - R.deep        1  23273312 1301164469 11724
## - depth         1  49725248 1327616405 11740
## - R.med         1  59454645 1337345802 11746
## - phi.core      1 110154394 1388045551 11777
## - gamma         1 219059092 1496950249 11839
## - Facies        7 526383446 1804274603 11980
adjusted_r2_step4 <- summary(model4)$adj.r.squared
rmse_step4 <- sqrt(mean(residuals(model4)^2))
cat("Adjusted R2:", adjusted_r2_step4, " | RMSE:", rmse_step4, "\n")
## Adjusted R2: 0.6815901  | RMSE: 1249.122

Plot measured vs. predicted permeability

predicted4 <- predict(model4, newdata = karpur_data)
plot(karpur_data$k.core, predicted4, xlab = "Measured Permeability", ylab = "Predicted Permeability",
     main = "Measured vs. Predicted Permeability (Model 4)")

—- Step 5: MLR of Log10(Permeability) with all well logs and Facies —-

model5 <- lm(log10_permeability ~ ., data = karpur_data)
adjusted_r2_model5 <- summary(model5)$adj.r.squared
rmse_model5 <- sqrt(mean(residuals(model5)^2))
cat("Adjusted R2:", adjusted_r2_model5, " | RMSE:", rmse_model5, "\n")
## Adjusted R2: 0.7456542  | RMSE: 0.2903109

Plot measured vs. predicted log10(permeability)

predicted5 <- predict(model5, newdata = karpur_data)
plot(log10_permeability, predicted5, xlab = "Measured log10(Permeability)", ylab = "Predicted log10(Permeability)",
     main = "Measured vs. Predicted log10(Permeability) (Model 5)")

—- Step 6: Stepwise Elimination (Model 5) —-

model6 <- step(model5, direction = "both")
## Start:  AIC=-1983.88
## log10_permeability ~ depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.deep + R.med + SP + density.corr + density + phi.core + 
##     k.core + Facies + phi.core.frac
## 
## 
## Step:  AIC=-1983.88
## log10_permeability ~ depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.deep + R.med + SP + density.corr + density + phi.core + 
##     k.core + Facies
## 
##                Df Sum of Sq    RSS     AIC
## - Facies        7    0.9845 70.010 -1986.3
## - R.deep        1    0.0046 69.030 -1985.8
## - depth         1    0.0511 69.077 -1985.3
## - ind.med       1    0.0749 69.101 -1985.0
## - SP            1    0.1033 69.129 -1984.7
## - R.med         1    0.1287 69.154 -1984.4
## - ind.deep      1    0.1681 69.194 -1983.9
## <none>                      69.026 -1983.9
## - density.corr  1    0.2148 69.240 -1983.3
## - gamma         1    0.4759 69.502 -1980.3
## - caliper       1    0.6209 69.647 -1978.5
## - phi.N         1    1.6663 70.692 -1966.3
## - density       1    2.0216 71.047 -1962.2
## - phi.core      1   14.0977 83.123 -1833.7
## - k.core        1   19.8344 88.860 -1779.0
## 
## Step:  AIC=-1986.28
## log10_permeability ~ depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.deep + R.med + SP + density.corr + density + phi.core + 
##     k.core
## 
##                Df Sum of Sq    RSS     AIC
## - R.deep        1    0.0029 70.013 -1988.2
## - SP            1    0.0353 70.045 -1987.9
## - ind.med       1    0.0527 70.063 -1987.7
## - depth         1    0.0864 70.097 -1987.3
## - R.med         1    0.1528 70.163 -1986.5
## - ind.deep      1    0.1581 70.168 -1986.4
## <none>                      70.010 -1986.3
## - density.corr  1    0.1915 70.202 -1986.0
## + Facies        7    0.9845 69.026 -1983.9
## - gamma         1    0.9247 70.935 -1977.5
## - caliper       1    1.1696 71.180 -1974.7
## - phi.N         1    2.2434 72.254 -1962.5
## - density       1    2.3311 72.341 -1961.5
## - phi.core      1   16.9538 86.964 -1810.7
## - k.core        1   25.9257 95.936 -1730.3
## 
## Step:  AIC=-1988.25
## log10_permeability ~ depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.med + SP + density.corr + density + phi.core + 
##     k.core
## 
##                Df Sum of Sq    RSS     AIC
## - SP            1    0.0420 70.055 -1989.8
## - ind.med       1    0.0582 70.071 -1989.6
## - depth         1    0.0862 70.099 -1989.2
## - ind.deep      1    0.1671 70.180 -1988.3
## <none>                      70.013 -1988.2
## - density.corr  1    0.1896 70.203 -1988.0
## + R.deep        1    0.0029 70.010 -1986.3
## + Facies        7    0.9828 69.030 -1985.8
## - gamma         1    0.9416 70.955 -1979.3
## - R.med         1    0.9727 70.986 -1979.0
## - caliper       1    1.1748 71.188 -1976.6
## - phi.N         1    2.2449 72.258 -1964.4
## - density       1    2.4035 72.416 -1962.6
## - phi.core      1   16.9523 86.965 -1812.7
## - k.core        1   26.3009 96.314 -1729.0
## 
## Step:  AIC=-1989.76
## log10_permeability ~ depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.med + density.corr + density + phi.core + k.core
## 
##                Df Sum of Sq    RSS     AIC
## - ind.med       1    0.0543 70.109 -1991.1
## - depth         1    0.0831 70.138 -1990.8
## - ind.deep      1    0.1603 70.215 -1989.9
## <none>                      70.055 -1989.8
## - density.corr  1    0.1785 70.234 -1989.7
## + SP            1    0.0420 70.013 -1988.2
## + R.deep        1    0.0096 70.045 -1987.9
## + Facies        7    0.9082 69.147 -1986.5
## - gamma         1    0.9074 70.962 -1981.2
## - R.med         1    0.9323 70.987 -1980.9
## - caliper       1    1.1514 71.206 -1978.4
## - phi.N         1    2.3482 72.403 -1964.8
## - density       1    2.3882 72.443 -1964.3
## - phi.core      1   16.9572 87.012 -1814.2
## - k.core        1   26.5342 96.589 -1728.7
## 
## Step:  AIC=-1991.13
## log10_permeability ~ depth + caliper + ind.deep + gamma + phi.N + 
##     R.med + density.corr + density + phi.core + k.core
## 
##                Df Sum of Sq    RSS     AIC
## - depth         1    0.0758 70.185 -1992.2
## <none>                      70.109 -1991.1
## - density.corr  1    0.2130 70.322 -1990.6
## + ind.med       1    0.0543 70.055 -1989.8
## + SP            1    0.0381 70.071 -1989.6
## + R.deep        1    0.0172 70.092 -1989.3
## + Facies        7    0.9040 69.205 -1987.8
## - ind.deep      1    0.8204 70.930 -1983.6
## - gamma         1    0.8531 70.962 -1983.2
## - R.med         1    0.9993 71.109 -1981.5
## - caliper       1    1.1570 71.266 -1979.7
## - phi.N         1    2.4295 72.539 -1965.2
## - density       1    2.5137 72.623 -1964.3
## - phi.core      1   16.9117 87.021 -1816.1
## - k.core        1   28.4075 98.517 -1714.5
## 
## Step:  AIC=-1992.24
## log10_permeability ~ caliper + ind.deep + gamma + phi.N + R.med + 
##     density.corr + density + phi.core + k.core
## 
##                Df Sum of Sq    RSS     AIC
## <none>                      70.185 -1992.2
## - density.corr  1    0.1945 70.380 -1992.0
## + depth         1    0.0758 70.109 -1991.1
## + ind.med       1    0.0470 70.138 -1990.8
## + SP            1    0.0355 70.150 -1990.7
## + R.deep        1    0.0156 70.170 -1990.4
## + Facies        7    0.9638 69.221 -1989.6
## - R.med         1    0.9436 71.129 -1983.3
## - gamma         1    1.0564 71.241 -1982.0
## - caliper       1    1.9123 72.097 -1972.2
## - ind.deep      1    2.2970 72.482 -1967.9
## - density       1    2.4386 72.624 -1966.3
## - phi.N         1    2.9529 73.138 -1960.5
## - phi.core      1   17.0365 87.222 -1816.3
## - k.core        1   29.7789 99.964 -1704.6
adjusted_r2_step6 <- summary(model6)$adj.r.squared
rmse_step6 <- sqrt(mean(residuals(model6)^2))
cat("Adjusted R2:", adjusted_r2_step6, " | RMSE:", rmse_step6, "\n")
## Adjusted R2: 0.7448982  | RMSE: 0.292739

Plot measured vs. predicted log10(permeability)

predicted6 <- predict(model6, newdata = karpur_data)

plot(log10_permeability, predicted6, xlab = "Measured log10(Permeability)", ylab = "Predicted log10(Permeability)",
     main = "Measured vs. Predicted log10(Permeability) (Model 6)")

model 7 Random Sub-sampling Cross-Validation (CV) applied on MLR of Log10(Permeability) given all well logs with Facies.

data3$log_k_core <- log10(data3$k.core)
library(caret)
## Warning: package 'caret' was built under R version 4.4.2
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.4.2
## Loading required package: lattice
set.seed(123)
train_index = createDataPartition(data3$log_k_core, p = 0.67, list = FALSE)
train_data = data3[train_index, ]
test_data = data3[-train_index, ]
Predicted_Permeabiity_Model_4<- lm(log_k_core~.-k.core,data=train_data)
summary(Predicted_Permeabiity_Model_4)
## 
## Call:
## lm(formula = log_k_core ~ . - k.core, data = train_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.63072 -0.11223  0.03652  0.14171  0.72653 
## 
## Coefficients: (1 not defined because of singularities)
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -3.1528438  5.8994071  -0.534 0.593265    
## depth          0.0009582  0.0006110   1.568 0.117431    
## caliper       -0.4446846  0.3409032  -1.304 0.192652    
## ind.deep      -0.0009556  0.0007647  -1.250 0.211954    
## ind.med        0.0008752  0.0008445   1.036 0.300512    
## gamma         -0.0078715  0.0020532  -3.834 0.000141 ***
## phi.N         -1.9479851  0.5069395  -3.843 0.000136 ***
## R.deep        -0.0031459  0.0020084  -1.566 0.117864    
## R.med          0.0055215  0.0029157   1.894 0.058804 .  
## SP            -0.0015514  0.0010083  -1.539 0.124476    
## density.corr   1.1393219  1.6338379   0.697 0.485902    
## density        1.2975774  0.3976294   3.263 0.001172 ** 
## phi.core       0.0937129  0.0076810  12.201  < 2e-16 ***
## FaciesF10      0.2190849  0.1213529   1.805 0.071586 .  
## FaciesF2       0.0950972  0.1810512   0.525 0.599629    
## FaciesF3       0.0570353  0.1152831   0.495 0.620987    
## FaciesF5       0.1668566  0.1117783   1.493 0.136098    
## FaciesF7       0.3625122  0.2347997   1.544 0.123203    
## FaciesF8      -0.0468921  0.1320336  -0.355 0.722616    
## FaciesF9      -0.3011142  0.1452945  -2.072 0.038706 *  
## phi.core.frac         NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3398 on 531 degrees of freedom
## Multiple R-squared:  0.6706, Adjusted R-squared:  0.6589 
## F-statistic: 56.91 on 19 and 531 DF,  p-value: < 2.2e-16
Predicted_log10_permeability_7<-predict(Predicted_Permeabiity_Model_4,newdata=test_data)
Predicted_permeability_7<-10^Predicted_log10_permeability_7
plot(Predicted_permeability_7,test_data$k.core,main="Measured permeability vs Predicted permeability",ylab="Predicted permeability",xlab="Measured permeability")

model 8 :Applying step wise elimination to this model.

Stepwise_Model_4<-step(Predicted_Permeabiity_Model_4, direction = "backward")
## Start:  AIC=-1169.74
## log_k_core ~ (depth + caliper + ind.deep + ind.med + gamma + 
##     phi.N + R.deep + R.med + SP + density.corr + density + phi.core + 
##     k.core + Facies + phi.core.frac) - k.core
## 
## 
## Step:  AIC=-1169.74
## log_k_core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density.corr + density + phi.core + 
##     Facies
## 
##                Df Sum of Sq    RSS     AIC
## - density.corr  1    0.0562 61.382 -1171.2
## - ind.med       1    0.1240 61.450 -1170.6
## - ind.deep      1    0.1804 61.506 -1170.1
## - caliper       1    0.1965 61.523 -1170.0
## <none>                      61.326 -1169.7
## - SP            1    0.2734 61.599 -1169.3
## - R.deep        1    0.2834 61.609 -1169.2
## - depth         1    0.2840 61.610 -1169.2
## - R.med         1    0.4142 61.740 -1168.0
## - density       1    1.2299 62.556 -1160.8
## - gamma         1    1.6975 63.023 -1156.7
## - phi.N         1    1.7053 63.031 -1156.6
## - Facies        7    5.0474 66.373 -1140.2
## - phi.core      1   17.1913 78.517 -1035.6
## 
## Step:  AIC=-1171.23
## log_k_core ~ depth + caliper + ind.deep + ind.med + gamma + phi.N + 
##     R.deep + R.med + SP + density + phi.core + Facies
## 
##            Df Sum of Sq    RSS     AIC
## - ind.med   1    0.1459 61.528 -1171.9
## - caliper   1    0.1976 61.580 -1171.5
## - ind.deep  1    0.2054 61.588 -1171.4
## <none>                  61.382 -1171.2
## - SP        1    0.2683 61.650 -1170.8
## - R.deep    1    0.2878 61.670 -1170.7
## - depth     1    0.2908 61.673 -1170.6
## - R.med     1    0.4241 61.806 -1169.4
## - density   1    1.4632 62.845 -1160.2
## - phi.N     1    1.6495 63.032 -1158.6
## - gamma     1    1.6777 63.060 -1158.4
## - Facies    7    5.0922 66.474 -1141.3
## - phi.core  1   17.1602 78.542 -1037.4
## 
## Step:  AIC=-1171.93
## log_k_core ~ depth + caliper + ind.deep + gamma + phi.N + R.deep + 
##     R.med + SP + density + phi.core + Facies
## 
##            Df Sum of Sq    RSS     AIC
## - caliper   1    0.1611 61.689 -1172.5
## - ind.deep  1    0.1751 61.703 -1172.4
## - SP        1    0.2185 61.747 -1172.0
## <none>                  61.528 -1171.9
## - R.deep    1    0.2592 61.787 -1171.6
## - R.med     1    0.3813 61.909 -1170.5
## - depth     1    0.5263 62.054 -1169.2
## - density   1    1.4745 63.003 -1160.9
## - phi.N     1    1.5625 63.091 -1160.1
## - gamma     1    1.5734 63.101 -1160.0
## - Facies    7    6.9521 68.480 -1126.9
## - phi.core  1   17.0279 78.556 -1039.3
## 
## Step:  AIC=-1172.48
## log_k_core ~ depth + ind.deep + gamma + phi.N + R.deep + R.med + 
##     SP + density + phi.core + Facies
## 
##            Df Sum of Sq    RSS     AIC
## - SP        1    0.2025 61.892 -1172.7
## <none>                  61.689 -1172.5
## - R.deep    1    0.2564 61.946 -1172.2
## - ind.deep  1    0.3838 62.073 -1171.1
## - R.med     1    0.4260 62.115 -1170.7
## - density   1    1.3593 63.048 -1162.5
## - gamma     1    1.4473 63.136 -1161.7
## - phi.N     1    1.7777 63.467 -1158.8
## - depth     1    2.0564 63.746 -1156.4
## - Facies    7    8.8789 70.568 -1112.4
## - phi.core  1   17.7780 79.467 -1035.0
## 
## Step:  AIC=-1172.68
## log_k_core ~ depth + ind.deep + gamma + phi.N + R.deep + R.med + 
##     density + phi.core + Facies
## 
##            Df Sum of Sq    RSS     AIC
## - R.deep    1    0.1913 62.083 -1173.0
## <none>                  61.892 -1172.7
## - R.med     1    0.3613 62.253 -1171.5
## - ind.deep  1    0.4313 62.323 -1170.8
## - density   1    1.3322 63.224 -1162.9
## - gamma     1    1.4881 63.380 -1161.6
## - phi.N     1    1.7508 63.642 -1159.3
## - depth     1    2.0065 63.898 -1157.1
## - Facies    7    8.7603 70.652 -1113.7
## - phi.core  1   17.9425 79.834 -1034.4
## 
## Step:  AIC=-1172.98
## log_k_core ~ depth + ind.deep + gamma + phi.N + R.med + density + 
##     phi.core + Facies
## 
##            Df Sum of Sq    RSS     AIC
## <none>                  62.083 -1173.0
## - R.med     1    0.3001 62.383 -1172.3
## - ind.deep  1    0.4671 62.550 -1170.8
## - density   1    1.2358 63.319 -1164.1
## - gamma     1    1.4180 63.501 -1162.5
## - phi.N     1    1.8386 63.922 -1158.9
## - depth     1    1.8421 63.925 -1158.9
## - Facies    7    8.7262 70.809 -1114.5
## - phi.core  1   18.3618 80.445 -1032.2
summary(Stepwise_Model_4)
## 
## Call:
## lm(formula = log_k_core ~ depth + ind.deep + gamma + phi.N + 
##     R.med + density + phi.core + Facies, data = train_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.67933 -0.11096  0.02422  0.15624  0.69126 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.046e+01  2.167e+00  -4.827 1.81e-06 ***
## depth        1.571e-03  3.940e-04   3.988 7.59e-05 ***
## ind.deep    -2.619e-04  1.304e-04  -2.008 0.045120 *  
## gamma       -6.326e-03  1.808e-03  -3.499 0.000506 ***
## phi.N       -1.950e+00  4.894e-01  -3.984 7.71e-05 ***
## R.med        1.614e-03  1.002e-03   1.610 0.108082    
## density      1.234e+00  3.776e-01   3.266 0.001159 ** 
## phi.core     9.499e-02  7.545e-03  12.591  < 2e-16 ***
## FaciesF10    2.189e-01  1.190e-01   1.840 0.066322 .  
## FaciesF2     1.156e-01  1.792e-01   0.645 0.519036    
## FaciesF3     2.352e-02  1.109e-01   0.212 0.832064    
## FaciesF5     1.803e-01  1.051e-01   1.716 0.086768 .  
## FaciesF7     3.143e-01  2.254e-01   1.394 0.163764    
## FaciesF8    -6.347e-02  1.166e-01  -0.544 0.586536    
## FaciesF9    -3.582e-01  1.256e-01  -2.851 0.004529 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3403 on 536 degrees of freedom
## Multiple R-squared:  0.6666, Adjusted R-squared:  0.6579 
## F-statistic: 76.54 on 14 and 536 DF,  p-value: < 2.2e-16

Let’s plot the predicted vs measured permeability.

Predicted_log10_permeability_8 <-predict(Stepwise_Model_4,newdata=test_data)
Predicted_permeability_8<-10^Predicted_log10_permeability_8
plot(Predicted_permeability_8,test_data$k.core,main="Measured permeability vs Predicted permeability",xlab="Measured permeability",ylab="Predicted permeability")