Let’s import the data and install some useful packages .
pacman::p_load(rio,psych,ggplot2)
Karpur <- import("C:/Users/hp ZBook/OneDrive/Desktop/karpur.csv")
library(Metrics)
## Warning: package 'Metrics' was built under R version 4.4.2
First: MLR model to predict Permeability using all well logs without facies.
Predicted_Permeabiity_Model_1<- lm(k.core~ .-Facies,data=Karpur)
summary(Predicted_Permeabiity_Model_1 )
##
## Call:
## lm(formula = k.core ~ . - Facies, data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5549.5 -755.5 -178.1 578.0 11260.8
##
## Coefficients:
## 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 18320.336 2380.161 7.697 4.07e-14 ***
## ---
## 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
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_permeability_1 <- predict(Predicted_Permeabiity_Model_1, data = Karpur)
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_1, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Second:Applying step wise elimination to this model.
Stepwise_Model_1<-step(Predicted_Permeabiity_Model_1, 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) - Facies
##
## 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
summary(Stepwise_Model_1)
##
## Call:
## lm(formula = k.core ~ depth + caliper + ind.deep + ind.med +
## gamma + phi.N + R.deep + R.med + SP + density + phi.core,
## data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5545.3 -753.4 -177.1 576.8 11260.2
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60910.619 16525.937 3.686 0.000243 ***
## depth -7.409 1.442 -5.139 3.46e-07 ***
## caliper -3957.892 1054.270 -3.754 0.000186 ***
## ind.deep -14.146 2.314 -6.113 1.52e-09 ***
## ind.med 17.263 2.478 6.967 6.74e-12 ***
## gamma -77.461 5.465 -14.174 < 2e-16 ***
## phi.N -1825.771 1231.150 -1.483 0.138470
## R.deep -25.972 6.961 -3.731 0.000204 ***
## R.med 63.466 9.816 6.466 1.75e-10 ***
## SP -8.803 3.453 -2.549 0.010974 *
## density 7980.761 1075.902 7.418 3.02e-13 ***
## phi.core 18343.648 2366.693 7.751 2.75e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1441 on 807 degrees of freedom
## Multiple R-squared: 0.5903, Adjusted R-squared: 0.5847
## F-statistic: 105.7 on 11 and 807 DF, p-value: < 2.2e-16
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_permeability_2 <-predict(Stepwise_Model_1,data=Karpur)
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_2, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Third:MLR model to predict Permeability using all well logs ,this time including facies.
Predicted_Permeabiity_Model_2<- lm(k.core~ .+Facies ,data=Karpur)
summary(Predicted_Permeabiity_Model_2 )
##
## Call:
## lm(formula = k.core ~ . + Facies, data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5585.6 -568.9 49.2 476.5 8928.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.783e+04 1.760e+04 -3.853 0.000126 ***
## depth 8.544e+00 1.785e+00 4.786 2.02e-06 ***
## caliper 1.413e+03 1.019e+03 1.387 0.165789
## ind.deep -2.418e-01 2.354e+00 -0.103 0.918220
## ind.med 1.224e+00 2.585e+00 0.473 0.636062
## gamma -4.583e+01 6.010e+00 -7.626 6.88e-14 ***
## phi.N -2.010e+03 1.476e+03 -1.362 0.173540
## R.deep -2.344e+01 6.288e+00 -3.727 0.000207 ***
## R.med 5.643e+01 9.065e+00 6.225 7.76e-10 ***
## SP -7.125e+00 3.145e+00 -2.266 0.023736 *
## density.corr -2.567e+03 4.809e+03 -0.534 0.593602
## density 2.319e+03 1.173e+03 1.976 0.048458 *
## phi.core 1.921e+04 2.282e+03 8.418 < 2e-16 ***
## FaciesF10 8.921e+02 3.590e+02 2.485 0.013157 *
## FaciesF2 9.243e+02 5.818e+02 1.589 0.112514
## FaciesF3 4.393e+02 3.344e+02 1.313 0.189394
## FaciesF5 7.411e+02 3.428e+02 2.162 0.030908 *
## FaciesF7 -4.152e+01 5.742e+02 -0.072 0.942377
## FaciesF8 -1.179e+03 3.927e+02 -3.002 0.002770 **
## FaciesF9 -2.969e+03 4.298e+02 -6.908 1.00e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1262 on 799 degrees of freedom
## Multiple R-squared: 0.6889, Adjusted R-squared: 0.6815
## F-statistic: 93.12 on 19 and 799 DF, p-value: < 2.2e-16
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_permeability_3 <-predict(Predicted_Permeabiity_Model_2,data=Karpur)
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_3, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Fourth:Applying step wise elimination to this model.
Stepwise_Model_2<-step(Predicted_Permeabiity_Model_2, 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 + 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
summary(Stepwise_Model_2)
##
## Call:
## lm(formula = k.core ~ depth + ind.med + gamma + R.deep + R.med +
## SP + density + phi.core + Facies, data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5608.3 -567.8 35.9 500.7 8989.7
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.322e+04 6.625e+03 -6.523 1.22e-10 ***
## depth 6.648e+00 1.189e+00 5.590 3.11e-08 ***
## ind.med 1.078e+00 4.111e-01 2.623 0.008894 **
## gamma -5.324e+01 4.537e+00 -11.733 < 2e-16 ***
## R.deep -2.395e+01 6.264e+00 -3.824 0.000141 ***
## R.med 5.515e+01 9.022e+00 6.112 1.53e-09 ***
## SP -7.214e+00 3.118e+00 -2.313 0.020960 *
## density 1.880e+03 1.044e+03 1.800 0.072240 .
## phi.core 1.817e+04 2.184e+03 8.320 3.77e-16 ***
## FaciesF10 8.266e+02 3.533e+02 2.340 0.019553 *
## FaciesF2 7.035e+02 5.567e+02 1.264 0.206697
## FaciesF3 4.100e+02 3.228e+02 1.270 0.204443
## FaciesF5 5.913e+02 3.211e+02 1.841 0.065924 .
## FaciesF7 -3.159e+02 5.402e+02 -0.585 0.558866
## FaciesF8 -1.455e+03 3.122e+02 -4.661 3.69e-06 ***
## FaciesF9 -3.017e+03 3.764e+02 -8.017 3.82e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1262 on 803 degrees of freedom
## Multiple R-squared: 0.6874, Adjusted R-squared: 0.6816
## F-statistic: 117.7 on 15 and 803 DF, p-value: < 2.2e-16
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_permeability_4 <-predict(Stepwise_Model_2,data=Karpur)
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_4, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Fifth:MLR model to predict log10(Permeability) using all well logs including facies.
Karpur$log10_Permeability <-log10(Karpur$k.core)
Predicted_Permeabiity_Model_3<- lm(log10_Permeability~.-k.core+Facies ,data=Karpur)
summary(Predicted_Permeabiity_Model_3 )
##
## Call:
## lm(formula = log10_Permeability ~ . - k.core + Facies, data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.5804 -0.1138 0.0322 0.1529 0.7384
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.3461877 4.6532000 -0.504 0.61425
## depth 0.0007425 0.0004718 1.574 0.11596
## caliper -0.4605945 0.2693103 -1.710 0.08760 .
## ind.deep -0.0007951 0.0006222 -1.278 0.20168
## ind.med 0.0007137 0.0006833 1.044 0.29659
## gamma -0.0091269 0.0015885 -5.746 1.30e-08 ***
## phi.N -1.7628155 0.3901024 -4.519 7.16e-06 ***
## R.deep -0.0025878 0.0016620 -1.557 0.11987
## R.med 0.0044073 0.0023960 1.839 0.06622 .
## SP -0.0016935 0.0008312 -2.037 0.04194 *
## density.corr 1.4462633 1.2712045 1.138 0.25558
## density 1.6148374 0.3100921 5.208 2.44e-07 ***
## phi.core 9.4863406 0.6032903 15.724 < 2e-16 ***
## FaciesF10 0.0786460 0.0948909 0.829 0.40746
## FaciesF2 -0.0184334 0.1537793 -0.120 0.90462
## FaciesF3 -0.0307548 0.0883957 -0.348 0.72799
## FaciesF5 0.1094193 0.0906034 1.208 0.22753
## FaciesF7 0.2811620 0.1517797 1.852 0.06433 .
## FaciesF8 -0.0976234 0.1038054 -0.940 0.34727
## FaciesF9 -0.3562116 0.1135966 -3.136 0.00178 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3335 on 799 degrees of freedom
## Multiple R-squared: 0.6806, Adjusted R-squared: 0.673
## F-statistic: 89.6 on 19 and 799 DF, p-value: < 2.2e-16
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_log10_permeability_5 <-predict(Predicted_Permeabiity_Model_3,data=Karpur)
Predicted_permeability_5<-10^Predicted_log10_permeability_5
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_5, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Sixth:Applying step wise elimination to this model.
Stepwise_Model_3<-step(Predicted_Permeabiity_Model_3, direction = "both")
## Start: AIC=-1779.02
## log10_Permeability ~ (depth + caliper + ind.deep + ind.med +
## gamma + phi.N + R.deep + R.med + SP + density.corr + density +
## phi.core + k.core + Facies) - k.core + Facies
##
## Df Sum of Sq RSS AIC
## - ind.med 1 0.1213 88.981 -1779.9
## - density.corr 1 0.1440 89.004 -1779.7
## - ind.deep 1 0.1816 89.042 -1779.3
## <none> 88.860 -1779.0
## - R.deep 1 0.2696 89.130 -1778.5
## - depth 1 0.2754 89.135 -1778.5
## - caliper 1 0.3253 89.185 -1778.0
## - R.med 1 0.3763 89.236 -1777.6
## - SP 1 0.4617 89.322 -1776.8
## - phi.N 1 2.2710 91.131 -1760.3
## - density 1 3.0160 91.876 -1753.7
## - gamma 1 3.6713 92.531 -1747.9
## - Facies 7 7.0758 95.936 -1730.3
## - phi.core 1 27.4982 116.358 -1560.2
##
## Step: AIC=-1779.9
## log10_Permeability ~ depth + caliper + ind.deep + gamma + phi.N +
## R.deep + R.med + SP + density.corr + density + phi.core +
## Facies
##
## Df Sum of Sq RSS AIC
## - density.corr 1 0.1931 89.174 -1780.1
## <none> 88.981 -1779.9
## - ind.deep 1 0.2179 89.199 -1779.9
## - R.deep 1 0.2447 89.226 -1779.7
## - caliper 1 0.2921 89.273 -1779.2
## + ind.med 1 0.1213 88.860 -1779.0
## - R.med 1 0.3397 89.321 -1778.8
## - SP 1 0.4101 89.391 -1778.1
## - depth 1 0.4622 89.444 -1777.7
## - phi.N 1 2.2035 91.185 -1761.9
## - density 1 3.0113 91.993 -1754.6
## - gamma 1 3.5761 92.557 -1749.6
## - Facies 7 9.1242 98.106 -1714.0
## - phi.core 1 27.4190 116.400 -1561.9
##
## Step: AIC=-1780.12
## log10_Permeability ~ depth + caliper + ind.deep + gamma + phi.N +
## R.deep + R.med + SP + density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## - ind.deep 1 0.2180 89.392 -1780.1
## <none> 89.174 -1780.1
## + density.corr 1 0.1931 88.981 -1779.9
## - R.deep 1 0.2526 89.427 -1779.8
## + ind.med 1 0.1705 89.004 -1779.7
## - caliper 1 0.2676 89.442 -1779.7
## - R.med 1 0.3598 89.534 -1778.8
## - SP 1 0.3832 89.558 -1778.6
## - depth 1 0.5404 89.715 -1777.2
## - phi.N 1 2.0726 91.247 -1763.3
## - gamma 1 3.4838 92.658 -1750.7
## - density 1 3.6220 92.796 -1749.5
## - Facies 7 9.3567 98.531 -1712.4
## - phi.core 1 27.2273 116.402 -1563.9
##
## Step: AIC=-1780.12
## log10_Permeability ~ depth + caliper + gamma + phi.N + R.deep +
## R.med + SP + density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## <none> 89.392 -1780.1
## + ind.deep 1 0.2180 89.174 -1780.1
## + density.corr 1 0.1932 89.199 -1779.9
## - R.deep 1 0.2869 89.679 -1779.5
## + ind.med 1 0.1478 89.245 -1779.5
## - depth 1 0.3332 89.726 -1779.1
## - SP 1 0.4296 89.822 -1778.2
## - R.med 1 0.5085 89.901 -1777.5
## - caliper 1 0.5746 89.967 -1776.9
## - phi.N 1 2.3337 91.726 -1761.0
## - gamma 1 3.8214 93.214 -1747.8
## - density 1 3.8626 93.255 -1747.5
## - Facies 7 9.2100 98.602 -1713.8
## - phi.core 1 27.0935 116.486 -1565.3
summary(Stepwise_Model_3)
##
## Call:
## lm(formula = log10_Permeability ~ depth + caliper + gamma + phi.N +
## R.deep + R.med + SP + density + phi.core + Facies, data = Karpur)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.58182 -0.12001 0.03437 0.15230 0.70317
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.2671250 3.9316796 -0.322 0.74732
## depth 0.0006562 0.0003796 1.729 0.08420 .
## caliper -0.5608681 0.2470292 -2.270 0.02344 *
## gamma -0.0091497 0.0015626 -5.855 6.94e-09 ***
## phi.N -1.7463527 0.3816550 -4.576 5.50e-06 ***
## R.deep -0.0026554 0.0016551 -1.604 0.10903
## R.med 0.0049837 0.0023334 2.136 0.03300 *
## SP -0.0016140 0.0008221 -1.963 0.04996 *
## density 1.7602255 0.2990153 5.887 5.79e-09 ***
## phi.core 9.2753944 0.5949259 15.591 < 2e-16 ***
## FaciesF10 0.0896953 0.0945929 0.948 0.34330
## FaciesF2 0.0152576 0.1523676 0.100 0.92026
## FaciesF3 -0.0292379 0.0869197 -0.336 0.73667
## FaciesF5 0.1022238 0.0879087 1.163 0.24524
## FaciesF7 0.2794793 0.1462763 1.911 0.05641 .
## FaciesF8 -0.0932936 0.0927473 -1.006 0.31477
## FaciesF9 -0.3877078 0.1030388 -3.763 0.00018 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3339 on 802 degrees of freedom
## Multiple R-squared: 0.6787, Adjusted R-squared: 0.6722
## F-statistic: 105.9 on 16 and 802 DF, p-value: < 2.2e-16
Let’s plot the predicted vs measured permeability with respect to depth.
Predicted_log10_permeability_6 <-predict(Stepwise_Model_3,data=Karpur)
Predicted_permeability_6<-10^Predicted_log10_permeability_6
ggplot(Karpur) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_6, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Seventh:Random Sub-sampling Cross-Validation applied on MLR of Log10(Permeability) given all well logs with facies (15% testing ,85%training)
library(caTools)
## Warning: package 'caTools' was built under R version 4.4.2
split=sample.split(Karpur$log10_Permeability,SplitRatio = 0.85)
training_set=subset(Karpur,split==TRUE)
testing_set=subset(Karpur,split==FALSE)
Predicted_Permeabiity_Model_4<- lm(log10_Permeability~.-k.core+Facies ,data=training_set)
summary(Predicted_Permeabiity_Model_4)
##
## Call:
## lm(formula = log10_Permeability ~ . - k.core + Facies, data = training_set)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.0686 -0.1154 0.0303 0.1420 0.7267
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.7156366 4.8793128 -0.966 0.3342
## depth 0.0007391 0.0004905 1.507 0.1323
## caliper -0.1594724 0.2880273 -0.554 0.5800
## ind.deep -0.0010835 0.0006747 -1.606 0.1088
## ind.med 0.0010068 0.0007424 1.356 0.1755
## gamma -0.0087551 0.0016763 -5.223 2.35e-07 ***
## phi.N -1.7781564 0.4108940 -4.328 1.74e-05 ***
## R.deep -0.0024570 0.0017628 -1.394 0.1638
## R.med 0.0042798 0.0025376 1.687 0.0922 .
## SP -0.0019505 0.0008825 -2.210 0.0274 *
## density.corr 1.2456127 1.3619232 0.915 0.3607
## density 1.4432719 0.3284444 4.394 1.29e-05 ***
## phi.core 9.7212728 0.6322326 15.376 < 2e-16 ***
## FaciesF10 0.1572808 0.1010329 1.557 0.1200
## FaciesF2 0.0018406 0.1620608 0.011 0.9909
## FaciesF3 0.0006353 0.0937614 0.007 0.9946
## FaciesF5 0.1820557 0.0969226 1.878 0.0608 .
## FaciesF7 0.3763498 0.1584505 2.375 0.0178 *
## FaciesF8 -0.0131699 0.1105336 -0.119 0.9052
## FaciesF9 -0.2582805 0.1194933 -2.161 0.0310 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3245 on 676 degrees of freedom
## Multiple R-squared: 0.6879, Adjusted R-squared: 0.6791
## F-statistic: 78.42 on 19 and 676 DF, p-value: < 2.2e-16
Let’s plot the predicted (for testing data) vs measured permeability with respect to depth.
Predicted_log10_permeability_7<-predict(Predicted_Permeabiity_Model_4,newdata=testing_set)
Predicted_permeability_7<-10^Predicted_log10_permeability_7
ggplot(testing_set) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_7, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Eighth:Applying step wise elimination to this model.
Stepwise_Model_4<-step(Predicted_Permeabiity_Model_4, direction = "both")
## Start: AIC=-1547.07
## log10_Permeability ~ (depth + caliper + ind.deep + ind.med +
## gamma + phi.N + R.deep + R.med + SP + density.corr + density +
## phi.core + k.core + Facies) - k.core + Facies
##
## Df Sum of Sq RSS AIC
## - caliper 1 0.0323 71.202 -1548.8
## - density.corr 1 0.0881 71.258 -1548.2
## - ind.med 1 0.1936 71.364 -1547.2
## - R.deep 1 0.2045 71.375 -1547.1
## <none> 71.170 -1547.1
## - depth 1 0.2390 71.409 -1546.7
## - ind.deep 1 0.2715 71.441 -1546.4
## - R.med 1 0.2995 71.469 -1546.2
## - SP 1 0.5143 71.684 -1544.1
## - phi.N 1 1.9717 73.142 -1530.0
## - density 1 2.0329 73.203 -1529.5
## - gamma 1 2.8718 74.042 -1521.5
## - Facies 7 6.2481 77.418 -1502.5
## - phi.core 1 24.8910 96.061 -1340.3
##
## Step: AIC=-1548.76
## log10_Permeability ~ depth + 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.0836 71.286 -1549.9
## - ind.med 1 0.1814 71.384 -1549.0
## - R.deep 1 0.1993 71.402 -1548.8
## <none> 71.202 -1548.8
## - ind.deep 1 0.2676 71.470 -1548.2
## - R.med 1 0.3107 71.513 -1547.7
## + caliper 1 0.0323 71.170 -1547.1
## - SP 1 0.5082 71.710 -1545.8
## - depth 1 0.7240 71.926 -1543.7
## - density 1 2.0012 73.203 -1531.5
## - phi.N 1 2.0370 73.239 -1531.1
## - gamma 1 3.3312 74.533 -1518.9
## - Facies 7 7.8434 79.046 -1490.0
## - phi.core 1 26.3129 97.515 -1331.9
##
## Step: AIC=-1549.94
## log10_Permeability ~ depth + ind.deep + ind.med + gamma + phi.N +
## R.deep + R.med + SP + density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## - R.deep 1 0.2036 71.489 -1550.0
## <none> 71.286 -1549.9
## - ind.med 1 0.2353 71.521 -1549.7
## - R.med 1 0.3250 71.611 -1548.8
## + density.corr 1 0.0836 71.202 -1548.8
## - ind.deep 1 0.3311 71.617 -1548.7
## + caliper 1 0.0278 71.258 -1548.2
## - SP 1 0.4883 71.774 -1547.2
## - depth 1 0.7292 72.015 -1544.9
## - phi.N 1 1.9732 73.259 -1532.9
## - density 1 2.4309 73.717 -1528.6
## - gamma 1 3.3315 74.617 -1520.2
## - Facies 7 7.7972 79.083 -1491.7
## - phi.core 1 26.3472 97.633 -1333.0
##
## Step: AIC=-1549.96
## log10_Permeability ~ depth + ind.deep + ind.med + gamma + phi.N +
## R.med + SP + density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## - R.med 1 0.1847 71.674 -1550.2
## <none> 71.489 -1550.0
## + R.deep 1 0.2036 71.286 -1549.9
## - ind.med 1 0.2097 71.699 -1549.9
## - ind.deep 1 0.3066 71.796 -1549.0
## + density.corr 1 0.0879 71.402 -1548.8
## + caliper 1 0.0228 71.467 -1548.2
## - SP 1 0.3907 71.880 -1548.2
## - depth 1 0.6247 72.114 -1545.9
## - phi.N 1 2.0220 73.511 -1532.5
## - density 1 2.2833 73.773 -1530.1
## - gamma 1 3.2178 74.707 -1521.3
## - Facies 7 7.9668 79.456 -1490.4
## - phi.core 1 27.0244 98.514 -1328.8
##
## Step: AIC=-1550.16
## log10_Permeability ~ depth + ind.deep + ind.med + gamma + phi.N +
## SP + density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## - ind.med 1 0.1759 71.850 -1550.5
## <none> 71.674 -1550.2
## + R.med 1 0.1847 71.489 -1550.0
## + density.corr 1 0.1085 71.566 -1549.2
## - ind.deep 1 0.3050 71.979 -1549.2
## + R.deep 1 0.0633 71.611 -1548.8
## + caliper 1 0.0620 71.612 -1548.8
## - SP 1 0.4606 72.135 -1547.7
## - depth 1 0.6003 72.274 -1546.4
## - phi.N 1 1.8572 73.531 -1534.4
## - density 1 2.2572 73.931 -1530.6
## - gamma 1 3.7364 75.411 -1516.8
## - Facies 7 8.6147 80.289 -1485.2
## - phi.core 1 27.8885 99.563 -1323.4
##
## Step: AIC=-1550.46
## log10_Permeability ~ depth + ind.deep + gamma + phi.N + SP +
## density + phi.core + Facies
##
## Df Sum of Sq RSS AIC
## <none> 71.850 -1550.5
## + ind.med 1 0.1759 71.674 -1550.2
## + density.corr 1 0.1568 71.693 -1550.0
## + R.med 1 0.1508 71.699 -1549.9
## + R.deep 1 0.0496 71.800 -1548.9
## + caliper 1 0.0396 71.810 -1548.8
## - SP 1 0.3943 72.244 -1548.7
## - ind.deep 1 1.0610 72.911 -1542.2
## - depth 1 1.1175 72.967 -1541.7
## - phi.N 1 1.7359 73.586 -1535.8
## - density 1 2.3075 74.157 -1530.5
## - gamma 1 3.6782 75.528 -1517.7
## - Facies 7 10.7451 82.595 -1467.5
## - phi.core 1 27.7135 99.563 -1325.4
summary(Stepwise_Model_4)
##
## Call:
## lm(formula = log10_Permeability ~ depth + ind.deep + gamma +
## phi.N + SP + density + phi.core + Facies, data = training_set)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.06639 -0.11542 0.02481 0.16880 0.69257
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -7.772e+00 1.783e+00 -4.360 1.50e-05 ***
## depth 1.026e-03 3.151e-04 3.254 0.00119 **
## ind.deep -2.794e-04 8.811e-05 -3.171 0.00159 **
## gamma -8.496e-03 1.439e-03 -5.904 5.58e-09 ***
## phi.N -1.600e+00 3.946e-01 -4.056 5.56e-05 ***
## SP -1.648e-03 8.527e-04 -1.933 0.05362 .
## density 1.445e+00 3.090e-01 4.677 3.52e-06 ***
## phi.core 9.829e+00 6.065e-01 16.207 < 2e-16 ***
## FaciesF10 1.793e-01 9.984e-02 1.796 0.07301 .
## FaciesF2 1.575e-02 1.600e-01 0.098 0.92163
## FaciesF3 -1.618e-02 9.149e-02 -0.177 0.85967
## FaciesF5 2.069e-01 8.919e-02 2.320 0.02065 *
## FaciesF7 3.384e-01 1.525e-01 2.219 0.02679 *
## FaciesF8 -2.976e-02 9.773e-02 -0.305 0.76081
## FaciesF9 -2.896e-01 1.038e-01 -2.791 0.00541 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3248 on 681 degrees of freedom
## Multiple R-squared: 0.6849, Adjusted R-squared: 0.6784
## F-statistic: 105.7 on 14 and 681 DF, p-value: < 2.2e-16
Let’s plot the predicted (for testing data) vs measured permeability with respect to depth.
Predicted_log10_permeability_8 <-predict(Stepwise_Model_4,newdata=testing_set)
Predicted_permeability_8<-10^Predicted_log10_permeability_8
ggplot(testing_set) +
geom_line(aes(x = depth, y = k.core, color = "Measured permeability")) +
geom_line(aes(x = depth, y = Predicted_permeability_8, color = "Predicted permeability")) +
labs(title = "Predicted vs Measured Permeability with Respect to Depth",
x = "Depth",
y = "Permeability",
color = "Legend") +
scale_color_manual(values = c("Measured permeability" = "red",
"Predicted permeability" = "black")) +
theme_minimal()
Let’s measure RMSE for all models.
Model_1_RMSE=rmse(Karpur$k.core,Predicted_permeability_1)
Model_1_RMSE
## [1] 1430.118
Model_2_RMSE=rmse(Karpur$k.core,Predicted_permeability_2)
Model_2_RMSE
## [1] 1430.126
Model_3_RMSE=rmse(Karpur$k.core,Predicted_permeability_3)
Model_3_RMSE
## [1] 1246.201
Model_4_RMSE=rmse(Karpur$k.core,Predicted_permeability_4)
Model_4_RMSE
## [1] 1249.122
Model_5_RMSE=rmse(Karpur$k.core,Predicted_permeability_5)
Model_5_RMSE
## [1] 1333.017
Model_6_RMSE=rmse(Karpur$k.core,Predicted_permeability_6)
Model_6_RMSE
## [1] 1330.932
Model_7_RMSE=rmse(testing_set$k.core,Predicted_permeability_7)
Model_7_RMSE
## [1] 1144.985
Model_8_RMSE=rmse(testing_set$k.core,Predicted_permeability_8)
Model_8_RMSE
## [1] 1093.672