This homework was submitted and published to address and minimize the uncertainty during building a geological model, which is mostly resulted from scale difference. Therefore, a scale correction was made on core permeability to log scale.

First of all, we have to recall the DATA

rdata <- read.csv("karpur.csv",header=TRUE)
rdata<-read.csv("C:/Users/alzah/Downloads/Telegram Desktop/karpur.csv", header=TRUE)
summary(rdata)
##      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   Length:819        
##  1st Qu.:  657.33   Class :character  
##  Median : 1591.22   Mode  :character  
##  Mean   : 2251.91                     
##  3rd Qu.: 3046.82                     
##  Max.   :15600.00

Building a simple linear regression model

slr<-lm(phi.core~phi.N+Facies-1,data=rdata)
summary(slr)
## 
## Call:
## lm(formula = phi.core ~ phi.N + Facies - 1, data = rdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.3530  -1.1573  -0.0206   1.0463  10.2852 
## 
## Coefficients:
##           Estimate Std. Error t value Pr(>|t|)    
## phi.N       1.3364     1.8060    0.74     0.46    
## FaciesF1   31.4805     0.2777  113.37   <2e-16 ***
## FaciesF10  20.7680     0.5072   40.95   <2e-16 ***
## FaciesF2   17.5233     0.9390   18.66   <2e-16 ***
## FaciesF3   23.1939     0.4955   46.81   <2e-16 ***
## FaciesF5   27.2953     0.3914   69.74   <2e-16 ***
## FaciesF7   22.5164     0.8730   25.79   <2e-16 ***
## FaciesF8   30.5884     0.5019   60.94   <2e-16 ***
## FaciesF9   26.4448     0.4825   54.81   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.326 on 810 degrees of freedom
## Multiple R-squared:  0.9928, Adjusted R-squared:  0.9928 
## F-statistic: 1.246e+04 on 9 and 810 DF,  p-value: < 2.2e-16

Correcting core phi to log scale

phi.corrected<-predict(slr,rdata)
#cbind(rdata$phi.core,phi.corecorrected)

Plotting phi.core versus phi.corrected

plot(rdata$phi.core,phi.corrected, xlab='phi corrected',
     ylab='phi core', col='darkgreen', pch=16)

Building another simple linear regression model that combines k.core and phi.corrected

slr2<-lm(k.core~phi.corrected+Facies-1,data=rdata)
summary(slr2)
## 
## Call:
## lm(formula = k.core ~ phi.corrected + Facies - 1, data = rdata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5613.4  -596.9  -130.3   475.0 10449.1 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## phi.corrected  -4123.5      898.1  -4.591 5.11e-06 ***
## FaciesF1      132659.2    28386.2   4.673 3.47e-06 ***
## FaciesF10      87869.2    18968.5   4.632 4.21e-06 ***
## FaciesF2       73979.5    16049.0   4.610 4.69e-06 ***
## FaciesF3       97909.7    21087.4   4.643 4.00e-06 ***
## FaciesF5      118915.8    24729.2   4.809 1.81e-06 ***
## FaciesF7       95868.0    20496.1   4.677 3.40e-06 ***
## FaciesF8      130990.3    27786.3   4.714 2.86e-06 ***
## FaciesF9      111323.9    24049.6   4.629 4.28e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1546 on 810 degrees of freedom
## Multiple R-squared:  0.7652, Adjusted R-squared:  0.7626 
## F-statistic: 293.2 on 9 and 810 DF,  p-value: < 2.2e-16

Now we predicte the core permeability as a function of core porosity from the same dataset (rdata)

k.corrected<-predict(slr2,rdata)
#cbind(rdata$k.core,k.corrected)

Plotting k.core versus k.corrected

plot(rdata$k.core,k.corrected, xlab='k corrected',
     ylab='k core', col='gold', pch=16)
abline(0,1)

Saving the new corrected k in data file

rdata<-cbind(rdata,k.corrected)
write.csv(rdata, "rdata.csv")

Plotting parameters versus depth

par(mfrow=c(1,3))

plot(y=y<-(rdata$depth),ylim=rev(range(rdata$depth)),x=x<-(rdata$phi.core),type="l", col="green", lwd = 5, pch=17, xlab='phi.core',
     ylab='Depth, m', cex=1, cex.lab=1, cex.axis=1)

plot(y=y<-(rdata$depth),ylim=rev(range(rdata$depth)),x=x<-(rdata$phi.N),type="l", col="red", lwd = 5, pch=10, xlab='phi.N',
     ylab='Depth, m', cex=1, cex.lab=1, cex.axis=1)

plot(y=y<-(rdata$depth),ylim=rev(range(rdata$depth)),x=x<-(phi.corrected),type="l", col="orange", lwd = 5, pch=17, xlab='phi.corrected',
     ylab='Depth, m', cex=1, cex.lab=1, cex.axis=1)

par(mfrow=c(1,2))

plot(y=y<-(rdata$depth),ylim=rev(range(rdata$depth)),x=x<-(k.corrected),type="l", col="pink", lwd = 5, pch=17, xlab='k.corrected',
     ylab='Depth, m', cex=1, cex.lab=1, cex.axis=1)

plot(y=y<-(rdata$depth),ylim=rev(range(rdata$depth)),x=x<-(rdata$k.core),type="l", col="blue", lwd = 5, pch=17, xlab='k.core',
     ylab='Depth, m', cex=1, cex.lab=1, cex.axis=1)