Conditional Inference Trees (CITs) is popular tool for regression analysis. CITs estimate a regression relationship by binary recursive partitioning in a conditional inference framework. Different relationships between data can be described with directed and undirected graphs. Based on ts concept, CITs can be used to model categorical variables responses given continuous predictors.

Therefore, CITs was adopted her to predict the discrete Distribution of Facies in a sandstone formation through Karpur Dataset.

Install the packages required to implement CITs algorithm with their functions.

require(party)
## Loading required package: party
## Loading required package: grid
## Loading required package: mvtnorm
## Loading required package: modeltools
## Loading required package: stats4
## Loading required package: strucchange
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Loading required package: sandwich
require(ipred)
## Loading required package: ipred
require(doParallel)
## Loading required package: doParallel
## Loading required package: foreach
## Loading required package: iterators
## Loading required package: parallel
require(foreach)
require(rgenoud)
## Loading required package: rgenoud
## ##  rgenoud (Version 5.7-12, Build Date: 2013-06-28)
## ##  See http://sekhon.berkeley.edu/rgenoud for additional documentation.
## ##  Please cite software as:
## ##   Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
## ##   ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
## ##   Journal of Statistical Software, 42(11): 1-26. 
## ##
require(ggplot2)
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## 
## The following object is masked _by_ '.GlobalEnv':
## 
##     mpg
require(MASS)
## Loading required package: MASS
require(lattice)
## Loading required package: lattice
library(party)
library(ipred)
library(doParallel)
library(foreach)
library(rgenoud)
library(ggplot2)
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:

Sample data and split it into two parts: train and test:

## [1] 571  14
## [1] 248  14

Modeling the Facies given well logs and core data through CITs model for the train partision:

## 
##   Conditional inference tree with 16 terminal nodes
## 
## Response:  Facies 
## Inputs:  depth, caliper, ind.deep, ind.med, gamma, phi.N, R.deep, R.med, SP, density.corr, density, phi.core, k.core 
## Number of observations:  571 
## 
## 1) depth <= 5723.5; criterion = 1, statistic = 468.77
##   2) phi.core <= 26.7824; criterion = 1, statistic = 38.59
##     3)*  weights = 7 
##   2) phi.core > 26.7824
##     4)*  weights = 83 
## 1) depth > 5723.5
##   5) density <= 2.21; criterion = 1, statistic = 372.606
##     6) depth <= 5982.5; criterion = 1, statistic = 231.673
##       7) depth <= 5856; criterion = 1, statistic = 165.411
##         8) ind.med <= 84.463; criterion = 1, statistic = 73.293
##           9)*  weights = 50 
##         8) ind.med > 84.463
##           10) R.med <= 6.419; criterion = 0.989, statistic = 16.707
##             11)*  weights = 30 
##           10) R.med > 6.419
##             12)*  weights = 7 
##       7) depth > 5856
##         13) phi.core <= 28.3; criterion = 1, statistic = 79.691
##           14)*  weights = 7 
##         13) phi.core > 28.3
##           15) density <= 2.078; criterion = 1, statistic = 46.679
##             16) phi.N <= 0.228; criterion = 1, statistic = 20.956
##               17)*  weights = 7 
##             16) phi.N > 0.228
##               18)*  weights = 120 
##           15) density > 2.078
##             19)*  weights = 7 
##     6) depth > 5982.5
##       20) k.core <= 3650; criterion = 1, statistic = 77.488
##         21) depth <= 6069; criterion = 1, statistic = 19.795
##           22)*  weights = 115 
##         21) depth > 6069
##           23)*  weights = 7 
##       20) k.core > 3650
##         24)*  weights = 12 
##   5) density > 2.21
##     25) R.med <= 4.672; criterion = 1, statistic = 50.428
##       26) depth <= 5891.5; criterion = 1, statistic = 35.205
##         27) density <= 2.271; criterion = 0.969, statistic = 9.205
##           28)*  weights = 39 
##         27) density > 2.271
##           29)*  weights = 66 
##       26) depth > 5891.5
##         30)*  weights = 7 
##     25) R.med > 4.672
##       31)*  weights = 7

Head & Sumary of predicted discrtet distributions of Facies for train partision:

## [1] F1 F1 F1 F1 F1 F1
## Levels: F1 F10 F2 F3 F5 F7 F8 F9

Boxplot of observed and predicted Facies for the train data:

CITs Modeling Validation by computing the total correct percent for train data.

##      
## qq     F1 F10  F2  F3  F5  F7  F8  F9
##   F1   87   3   0   0   0   0   0   0
##   F10   0 101   0   9   0   0   0   2
##   F2    0   0   0   0   0   0   0   0
##   F3    0  10   2  23   0   2   0   0
##   F5    0   1   1   2  70   0   0   2
##   F7    0   0   0   0   1   3   3   0
##   F8    0   2   0   0   3   0 129   0
##   F9    0   0   0   0   0   0   0 115
##        F1       F10        F2        F3        F5        F7        F8 
## 1.0000000 0.8632479 0.0000000 0.6764706 0.9459459 0.6000000 0.9772727 
##        F9 
## 0.9663866

Total percent correct that reflects the CITs accuracy of classificationin train data:

## [1] 0.9246935

Total percent correct that reflects the CITs accuracy of classificationin test data based on train modeling:

##         
## testPred F1 F10 F2 F3 F5 F7 F8 F9
##      F1  24   0  0  0  0  0  0  0
##      F10  0  47  2 11  0  0  0  0
##      F2   0   0  0  0  0  0  0  0
##      F3   0   2  2  8  1  0  0  0
##      F5   0   4  1  2 27  0  0  2
##      F7   0   0  0  0  3  4  2  0
##      F8   0   1  0  0  4  0 49  0
##      F9   0   0  0  0  0  0  1 51
##        F1       F10        F2        F3        F5        F7        F8 
## 1.0000000 0.8703704 0.0000000 0.3809524 0.7714286 1.0000000 0.9423077 
##        F9 
## 0.9622642
## [1] 0.8467742

Decison Tree Plots:

Scattermatrix plot of Lithofacies Classification by CITs:

Visualizing the predicted discrete distribution of the Eight Facies for the full dataset:

## 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, 5681, 5695.25,
## 5709.5, : some notches went outside hinges ('box'): maybe set notch=FALSE

References

  1. Hothorn, T. K. Hornik and A. Zeileis. (2006). Unbiased Recursive Partitioning: A Conditional Inference Framework. Journal of Computational and Graphical Statistics, 15(3), 651–674. Preprint available from http://statmath.wu-wien.ac.at/~zeileis/papers/Hothorn+Hornik+Zeileis-2006.pdf

  2. 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.

  3. Karpur, L., L. Lake, and K. Sepehrnoori. (2000). Probability Logs for Facies Classification. In Situ 24(1): 57.

  4. 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.

  5. Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 1. Naive Bayes Classifier for Lithofacies Modeling in a Sandstone Formation. RPubs.

  6. 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.

  7. Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 3. Linear Discriminant Analysis (LDA) for Multinomial Lithofacies Classification in a Sandstone Formation. RPubs.

  8. Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 4. Applied Geostatistics in R: 4. Multinomial Logistic Regression (MLR) for Posterior Lithofacies Probability Prediction in a Sandstone Formation. RPubs.

  9. Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 5. Improved Reservoir Characterization through Facies Tree-Based Classification Models. RPubs.

  10. Al-Mudhafar, W. J. (2015). Applied Geostatistics in R: 6. Integrating Well Logs and Core Data into Facies Classification through Kernel Support Vector Machine. RPubs.