The Multinomial Logistic Regression (MLR) was adopted to estimate the maximum likelihood and minimize the standard error for the nonlinear relationships between facies & core and log data in sandstone formation. The MLR is used to predict the probabilities of the different possible facies given each independent variable by constructing a linear predictor function having a set of weights that are linearly combined with the independent variables by using a dot product. Beta distribution of facies was considered as prior knowledge and the resulted predicted probability (posterior) was estimated from MLR based on Bayes’ theorem that represents the relationship between predicted probability (posterior) with the conditional probability and the prior knowledge.
In this work, MLR was adopted here to model Lithofacies given core analysis and well logs data in order to predict posterior probability distributions of the Lithofacies in Karpur Dataset.
Install the packages required to implement MLR algorithm with their functions.
#First, install the required packages.
require(foreign)
## Loading required package: foreign
require(nnet)
## Loading required package: nnet
require(ggplot2)
## Loading required package: ggplot2
##
## Attaching package: 'ggplot2'
##
## The following object is masked _by_ '.GlobalEnv':
##
## mpg
require(reshape2)
## Loading required package: reshape2
require(MASS)
## Loading required package: MASS
require(lattice)
## Loading required package: lattice
library(foreign)
library(nnet)
library(ggplot2)
library(reshape2)
library(MASS)
library(lattice)
Call the dataset and show the dataset head: -
## depth caliper ind.deep ind.med gamma phi.N R.deep R.med SP
## 1 5667.0 8.685 618.005 569.781 98.823 0.410 1.618 1.755 -56.587
## 2 5667.5 8.686 497.547 419.494 90.640 0.307 2.010 2.384 -61.916
## 3 5668.0 8.686 384.935 300.155 78.087 0.203 2.598 3.332 -55.861
## 4 5668.5 8.686 278.324 205.224 66.232 0.119 3.593 4.873 -41.860
## 5 5669.0 8.686 183.743 131.155 59.807 0.069 5.442 7.625 -34.934
## 6 5669.5 8.686 109.512 75.633 57.109 0.048 9.131 13.222 -39.769
## density.corr density phi.core k.core Facies
## 1 -0.033 2.205 33.9000 2442.590 F1
## 2 -0.067 2.040 33.4131 3006.989 F1
## 3 -0.064 1.888 33.1000 3370.000 F1
## 4 -0.053 1.794 34.9000 2270.000 F1
## 5 -0.054 1.758 35.0644 2530.758 F1
## 6 -0.058 1.759 35.3152 2928.314 F1
Summary of the dataset.
## depth caliper ind.deep ind.med
## Min. :5667 Min. :8.487 Min. : 6.532 Min. : 9.386
## 1st Qu.:5769 1st Qu.:8.556 1st Qu.: 28.799 1st Qu.: 27.892
## Median :5872 Median :8.588 Median :217.849 Median :254.383
## Mean :5873 Mean :8.622 Mean :275.357 Mean :273.357
## 3rd Qu.:5977 3rd Qu.:8.686 3rd Qu.:566.793 3rd Qu.:544.232
## Max. :6083 Max. :8.886 Max. :769.484 Max. :746.028
##
## gamma phi.N R.deep R.med
## Min. : 16.74 Min. :0.0150 Min. : 1.300 Min. : 1.340
## 1st Qu.: 40.89 1st Qu.:0.2030 1st Qu.: 1.764 1st Qu.: 1.837
## Median : 51.37 Median :0.2450 Median : 4.590 Median : 3.931
## Mean : 53.42 Mean :0.2213 Mean : 24.501 Mean : 21.196
## 3rd Qu.: 62.37 3rd Qu.:0.2640 3rd Qu.: 34.724 3rd Qu.: 35.853
## Max. :112.40 Max. :0.4100 Max. :153.085 Max. :106.542
##
## SP density.corr density phi.core
## Min. :-73.95 Min. :-0.067000 Min. :1.758 Min. :15.70
## 1st Qu.:-42.01 1st Qu.:-0.016000 1st Qu.:2.023 1st Qu.:23.90
## Median :-32.25 Median :-0.007000 Median :2.099 Median :27.60
## Mean :-30.98 Mean :-0.008883 Mean :2.102 Mean :26.93
## 3rd Qu.:-19.48 3rd Qu.: 0.002000 3rd Qu.:2.181 3rd Qu.:30.70
## Max. : 25.13 Max. : 0.089000 Max. :2.387 Max. :36.30
##
## k.core Facies
## Min. : 0.42 F8 :184
## 1st Qu.: 657.33 F9 :172
## Median : 1591.22 F10 :171
## Mean : 2251.91 F1 :111
## 3rd Qu.: 3046.82 F5 :109
## Max. :15600.00 F3 : 55
## (Other): 17
Visualize the dataset:
Modeling the Facies given well logs and core data through logit model:
## # weights: 120 (98 variable)
## initial value 1703.062623
## iter 10 value 1179.097291
## iter 20 value 923.251965
## iter 30 value 741.869499
## iter 40 value 699.925734
## iter 50 value 669.052852
## iter 60 value 511.166733
## iter 70 value 233.307615
## iter 80 value 165.773024
## iter 90 value 149.046112
## iter 100 value 143.271119
## final value 143.271119
## stopped after 100 iterations
## Call:
## multinom(formula = Facies ~ ., data = karpur)
##
## Coefficients:
## (Intercept) depth caliper ind.deep ind.med
## F10 1.3249216 0.03558881 -23.79343 -0.078893229 0.107200338
## F2 -0.7030409 -0.07139423 42.94152 -0.138309461 0.094987785
## F3 -4.7420964 0.03411561 -18.00088 -0.034711051 0.039036141
## F5 -2.3328252 0.04777032 -36.80878 -0.005556634 0.049998192
## F7 -2.9665276 0.08969584 -49.46010 -0.111723916 0.093393279
## F8 5.9191162 0.11246371 -67.57402 0.136081879 -0.108676043
## F9 -24.4366661 0.10627313 -70.16444 0.021352685 0.008709291
## gamma phi.N R.deep R.med SP density.corr
## F10 0.001451278 -4.075735 -1.14305785 0.78639406 0.2163548 -26.5048743
## F2 -0.268862190 64.296752 0.14138328 -0.10051642 0.3389351 20.6189492
## F3 0.006513390 -17.915430 -0.37171801 -0.81591784 0.2382539 11.7895843
## F5 -0.104520300 -26.816641 0.37442197 -0.07980776 0.2715597 0.1183814
## F7 -0.250153962 5.570544 0.63917019 -1.60843274 0.5370318 -12.6942142
## F8 -0.250816269 140.286848 0.09286815 0.37789591 0.3635810 26.0160718
## F9 -0.034391343 -38.296631 0.50692783 -0.76910395 0.2345840 6.9857913
## density phi.core k.core
## F10 21.253094 -1.3484797 0.0014794057
## F2 39.113017 -1.2693197 0.0026765722
## F3 7.939868 -1.0247206 0.0004440008
## F5 42.617126 -1.3637551 0.0015651948
## F7 -6.913537 -1.7189047 0.0022511295
## F8 -57.534546 0.4215114 0.0006056535
## F9 15.174861 -0.3494023 -0.0003468794
##
## Std. Errors:
## (Intercept) depth caliper ind.deep ind.med
## F10 1.626525e-04 0.0006739397 0.0034151428 0.02839299 0.03094461
## F2 1.699411e-05 0.0018016739 0.0003965183 0.04506779 0.03116101
## F3 2.234001e-04 0.0008718193 0.0039348955 0.03021259 0.03229385
## F5 3.512388e-04 0.0007780270 0.0034591822 0.03173309 0.03220826
## F7 6.214727e-05 0.0009936439 0.0006544188 0.04594043 0.04629303
## F8 8.597274e-05 0.0009490570 0.0011032899 0.03977366 0.03987110
## F9 3.240219e-04 0.0012325262 0.0019039931 0.03534800 0.03522616
## gamma phi.N R.deep R.med SP density.corr
## F10 0.05188385 0.0008041702 0.06617982 0.085732712 0.05486889 1.544571e-04
## F2 0.08475352 0.0002983262 0.01152008 0.009430983 0.12515670 1.246482e-04
## F3 0.05653545 0.0010860058 0.10046459 0.079686076 0.05507273 3.062929e-04
## F5 0.05588490 0.0006352753 0.06145501 0.081607216 0.06220176 5.555157e-05
## F7 0.12325414 0.0002492856 0.02874876 0.032669869 0.11723949 6.568225e-05
## F8 0.09334847 0.0001407760 0.06321059 0.073479428 0.07039828 7.945238e-05
## F9 0.07228661 0.0007118421 0.01420407 0.012703081 0.07062237 1.514685e-04
## density phi.core k.core
## F10 0.0011094519 0.099443804 0.0006273644
## F2 0.0003240220 0.001857373 0.0015358179
## F3 0.0014522702 0.100665839 0.0006140135
## F5 0.0011722261 0.126498651 0.0008243391
## F7 0.0002077363 0.012529974 0.0008988777
## F8 0.0002166092 0.013373048 0.0009730033
## F9 0.0007852280 0.137385218 0.0009459605
##
## Residual Deviance: 286.5422
## AIC: 482.5422
Test data and extract coefficients:
## (Intercept) depth caliper ind.deep ind.med gamma
## F10 8145.719 52.80710 -6967.037 -2.7786164 3.4642650 0.02797168
## F2 -41369.686 -39.62661 108296.429 -3.0689204 3.0482898 -3.17228362
## F3 -21226.920 39.13152 -4574.678 -1.1488937 1.2087795 0.11520895
## F5 -6641.707 61.39931 -10640.890 -0.1751054 1.5523406 -1.87027788
## F7 -47733.839 90.26960 -75578.664 -2.4319301 2.0174372 -2.02957863
## F8 68848.759 118.50048 -61247.749 3.4214070 -2.7256849 -2.68688145
## F9 -75416.708 86.22383 -36851.207 0.6040706 0.2472393 -0.47576369
## phi.N R.deep R.med SP density.corr density
## F10 -5068.249 -17.271999 9.1726255 3.943122 -171600.285 19156.390
## F2 215524.956 12.272773 -10.6581062 2.708086 165417.209 120710.987
## F3 -16496.625 -3.699990 -10.2391519 4.326169 38491.210 5467.212
## F5 -42212.628 6.092619 -0.9779498 4.365788 2131.019 36355.722
## F7 22346.033 22.232968 -49.2329112 4.580640 -193267.048 -33280.359
## F8 996525.431 1.469187 5.1428804 5.164629 327442.330 -265614.525
## F9 -53799.338 35.688909 -60.5446771 3.321667 46120.427 19325.420
## phi.core k.core
## F10 -13.560218 2.3581282
## F2 -683.395216 1.7427666
## F3 -10.179427 0.7231125
## F5 -10.780788 1.8987269
## F7 -137.183425 2.5043781
## F8 31.519471 0.6224578
## F9 -2.543231 -0.3666955
## (Intercept) depth caliper ind.deep ind.med gamma phi.N
## F10 0 0 0 0.0054590949 0.0005316825 0.977684738 0
## F2 0 0 0 0.0021483384 0.0023014786 0.001512452 0
## F3 0 0 0 0.2505998251 0.2267475633 0.908279508 0
## F5 0 0 0 0.8609968293 0.1205807437 0.061445240 0
## F7 0 0 0 0.0150186052 0.0436499079 0.042399389 0
## F8 0 0 0 0.0006229803 0.0064168233 0.007212255 0
## F9 0 0 0 0.5457967013 0.8047230304 0.634242741 0
## R.deep R.med SP density.corr density phi.core
## F10 0.000000e+00 0.000000e+00 8.042759e-05 0 0 0.00000000
## F2 0.000000e+00 0.000000e+00 6.767252e-03 0 0 0.00000000
## F3 2.156077e-04 0.000000e+00 1.517248e-05 0 0 0.00000000
## F5 1.110784e-09 3.280991e-01 1.266652e-05 0 0 0.00000000
## F7 0.000000e+00 0.000000e+00 4.635562e-06 0 0 0.00000000
## F8 1.417822e-01 2.705579e-07 2.409160e-07 0 0 0.00000000
## F9 0.000000e+00 0.000000e+00 8.948150e-04 0 0 0.01098326
## k.core
## F10 0.01836735
## F2 0.08137438
## F3 0.46961079
## F5 0.05760039
## F7 0.01226669
## F8 0.53364089
## F9 0.71384620
## (Intercept) depth caliper ind.deep ind.med gamma
## F10 3.761890e+00 1.0362297 4.641375e-11 0.9241386 1.113157 1.0014523
## F2 4.950775e-01 0.9310948 4.459289e+18 0.8708292 1.099645 0.7642486
## F3 8.720346e-03 1.0347042 1.521657e-08 0.9658845 1.039808 1.0065346
## F5 9.702126e-02 1.0489297 1.033121e-16 0.9944588 1.051269 0.9007565
## F7 5.148177e-02 1.0938415 3.309431e-22 0.8942911 1.097893 0.7786809
## F8 3.720827e+02 1.1190316 4.497530e-30 1.1457757 0.897021 0.7781653
## F9 2.439443e-11 1.1121256 3.372642e-31 1.0215823 1.008747 0.9661933
## phi.N R.deep R.med SP density.corr density
## F10 1.697973e-02 0.3188426 2.1954654 1.241543 3.083751e-12 1.698640e+09
## F2 8.389274e+27 1.1518661 0.9043703 1.403452 9.009400e+08 9.695434e+16
## F3 1.657401e-08 0.6895487 0.4422332 1.269031 1.318716e+05 2.806991e+03
## F5 2.257776e-12 1.4541506 0.9232938 1.312009 1.125673e+00 3.223909e+18
## F7 2.625769e+02 1.8949078 0.2002011 1.710921 3.068830e-06 9.942347e-04
## F8 8.429543e+60 1.0973170 1.4592110 1.438471 1.989008e+11 1.030539e-25
## F9 2.333374e-17 1.6601830 0.4634281 1.264383 1.081162e+03 3.893665e+06
## phi.core k.core
## F10 0.2596347 1.0014805
## F2 0.2810227 1.0026802
## F3 0.3588967 1.0004441
## F5 0.2556988 1.0015664
## F7 0.1792624 1.0022537
## F8 1.5242636 1.0006058
## F9 0.7051094 0.9996532
Head of posterior distributions of Facies:
## [1] F10 F1 F1 F1 F1 F1
## Levels: F1 F10 F2 F3 F5 F7 F8 F9
## F1 F10 F2 F3 F5
## 1 0.4784723 5.199314e-01 8.499605e-16 1.587576e-03 8.701994e-06
## 2 0.9995572 2.379734e-04 2.495091e-19 2.048645e-04 7.624279e-10
## 3 0.9995367 2.771562e-06 5.128119e-20 4.604796e-04 5.623079e-12
## 4 0.9994384 2.615366e-08 3.208465e-20 5.616015e-04 4.778059e-14
## 5 0.9996121 5.312164e-08 1.189755e-17 3.878844e-04 4.161197e-14
## 6 0.9999993 3.287258e-08 3.409442e-16 6.290488e-07 8.830520e-15
## F7 F8 F9
## 1 4.346820e-28 6.385823e-10 3.068157e-12
## 2 2.342604e-27 6.109100e-12 1.204613e-13
## 3 1.165913e-23 6.669840e-13 9.022499e-14
## 4 5.766942e-21 1.655538e-13 4.385275e-13
## 5 2.480422e-18 2.570030e-15 2.110662e-13
## 6 1.634648e-20 1.165861e-17 1.532638e-15
Means of the Well logs and core data given each Facies:
MLR Modeling Validation by computing the total correct percent.
## F1 F10 F2 F3 F5 F7 F8
## 0.9819820 0.8947368 1.0000000 0.6181818 0.9082569 1.0000000 0.9728261
## F9
## 1.0000000
Total percent correct:
## [1] 0.9316239
Scatteratrix plot of Lithofacies Classification by MLR:
Visualizing the predicted posterior distribution of the Eight Facies.
Combining the posterior distribution of the eight Lithofacies in one plot.
## Warning in bxp(structure(list(stats = structure(c(5667, 5680.75, 5694.5, :
## some notches went outside hinges ('box'): maybe set notch=FALSE
## Warning in bxp(structure(list(stats = structure(c(5667.5, 5681.25, 5695, :
## some notches went outside hinges ('box'): maybe set notch=FALSE
References
Pires, A.M. and J.A. Branco, Projection-pursuit approach to robust linear discriminant analysis. Journal of Multivariate Analysis 101 24642485 (2010).
Al-Mudhafar, W. J. (2015). Integrating Component Analysis & Classification Techniques for Comparative Prediction of Continuous & Discrete Lithofacies Distributions. Offshore Technology Conference. doi:10.4043/25806-MS.
Karpur, L., L. Lake, and K. Sepehrnoori. (2000). Probability Logs for Facies Classification. In Situ 24(1): 57.
Al-Mudhafer, W. J. (2014). Multinomial Logistic Regression for Bayesian Estimation of Vertical Facies Modeling in Heterogeneous Sandstone Reservoirs. Offshore Technology Conference. doi:10.4043/24732-MS.
Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 1. Naive Bayes Classifier for Lithofacies Modeling in a Sandstone Formation. RPubs.
Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 2. Applied Geostatistics in R: 2. Logistic Boosting Regression (LogitBoost) for Multinomial Lithofacies Classification in a Sandstone Formation. RPubs.
Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 3. Linear Discriminant Analysis (LDA) for Multinomial Lithofacies Classification in a Sandstone Formation. RPubs.