R Markdown

# Data call
data2<-read.csv("c:/Users/InteL/Desktop/rd/karpur.csv")
head(data2)
##    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  X phi.core.frac
## 1       -0.033   2.205  33.9000 2442.590     F1 NA      0.339000
## 2       -0.067   2.040  33.4131 3006.989     F1 NA      0.334131
## 3       -0.064   1.888  33.1000 3370.000     F1 NA      0.331000
## 4       -0.053   1.794  34.9000 2270.000     F1 NA      0.349000
## 5       -0.054   1.758  35.0644 2530.758     F1 NA      0.350644
## 6       -0.058   1.759  35.3152 2928.314     F1 NA      0.353152
# Plot Porosity Model
plot(data2$phi.N,data2$phi.core.frac)

PoroModel<-lm(phi.core.frac~phi.N+Facies-1,data=data2)

par(mfrow=c(2,2))
plot(PoroModel)

summary(PoroModel)
## 
## Call:
## lm(formula = phi.core.frac ~ phi.N + Facies - 1, data = data2)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.103530 -0.011573 -0.000206  0.010463  0.102852 
## 
## Coefficients:
##           Estimate Std. Error t value Pr(>|t|)    
## phi.N     0.013364   0.018060    0.74     0.46    
## FaciesF1  0.314805   0.002777  113.37   <2e-16 ***
## FaciesF10 0.207680   0.005072   40.95   <2e-16 ***
## FaciesF2  0.175233   0.009390   18.66   <2e-16 ***
## FaciesF3  0.231939   0.004955   46.81   <2e-16 ***
## FaciesF5  0.272953   0.003914   69.74   <2e-16 ***
## FaciesF7  0.225164   0.008730   25.79   <2e-16 ***
## FaciesF8  0.305884   0.005019   60.94   <2e-16 ***
## FaciesF9  0.264448   0.004825   54.81   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02326 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
corrected_porosity<-predict(PoroModel,data2)
head(cbind(data2$phi.core.frac,predict(PoroModel)))
##       [,1]      [,2]
## 1 0.339000 0.3202847
## 2 0.334131 0.3189082
## 3 0.331000 0.3175183
## 4 0.349000 0.3163957
## 5 0.350644 0.3157275
## 6 0.353152 0.3154468
# now plot porosity corrected to log scale
plot(corrected_porosity)
permModel <- lm(data2$k.core~corrected_porosity,data=data2)
summary(permModel)
## 
## Call:
## lm(formula = data2$k.core ~ corrected_porosity, data = data2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2936.5 -1229.5  -641.6   355.4 13194.4 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         -4056.5      492.9  -8.231 7.34e-16 ***
## corrected_porosity  23422.6     1810.7  12.935  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2038 on 817 degrees of freedom
## Multiple R-squared:   0.17,  Adjusted R-squared:  0.169 
## F-statistic: 167.3 on 1 and 817 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))

plot(permModel)

corrected_permeability <- predict(permModel)
k.corel<-predict(permModel,data2)
plot(k.corel)
head(cbind(data2$k.core,corrected_permeability))
##            corrected_permeability
## 1 2442.590               3445.336
## 2 3006.989               3413.094
## 3 3370.000               3380.539
## 4 2270.000               3354.245
## 5 2530.758               3338.594
## 6 2928.314               3332.020
karpur2<-cbind(data2,k.corel)
write.csv(karpur2,"karpur2.csv")
head(karpur2)
##    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  X phi.core.frac  k.corel
## 1       -0.033   2.205  33.9000 2442.590     F1 NA      0.339000 3445.336
## 2       -0.067   2.040  33.4131 3006.989     F1 NA      0.334131 3413.094
## 3       -0.064   1.888  33.1000 3370.000     F1 NA      0.331000 3380.539
## 4       -0.053   1.794  34.9000 2270.000     F1 NA      0.349000 3354.245
## 5       -0.054   1.758  35.0644 2530.758     F1 NA      0.350644 3338.594
## 6       -0.058   1.759  35.3152 2928.314     F1 NA      0.353152 3332.020
# And finally plot permeability corrected to log scale
par(mfrow=c(1,3))

plot(y=y<-(data2$depth),ylim=rev(range(data2$depth)),x=x<-(data2$ phi.core),type="l", col="darkgreen", lwd = 5, pch=17, xlab='phi.core.frac',
     ylab='Depth, m', xlim=c(14,38), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
plot(y=y<-(data2$depth),ylim=rev(range(data2$depth)),x=x<-(data2$ k.core),type="l", col="red", lwd = 5, pch=17, xlab='k.core',
     ylab='Depth, m', xlim=c(0.22,15800.00), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
plot(y=y<-(data2$depth),ylim=rev(range(data2$depth)),x=x<-(data2$ phi.N),type="l", col="yellow", lwd = 5, pch=17, xlab='phi.N',
     ylab='Depth, m', xlim=c(0.012,0.510), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()

par(mfrow=c(1,3))
plot(y=y<-(data2$depth),ylim=rev(range(data2$depth)),x=x<-(k.corel),type="l", col="blue", lwd = 5, pch=17, xlab='k.corel',
     ylab='Depth, m', xlim=c(10,6400), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()