R Markdown
datam <-read.csv("C:\\Users\\mo\\OneDrive\\Desktop\\mak\\karpur.csv",TRUE) #Importing data
head(datam)
## 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(datam$phi.N,datam$phi.core.frac,ylab ="log porosity" ,xlab = "core porosity" )
abline(lm(phi.N ~ phi.core.frac,data = datam), lwd=3, col='red')

model1 <- lm(phi.N ~ phi.core.frac +Facies-1, data = datam) # Now we create first model between porosity core and porosity log with facies
summary(model1)
##
## Call:
## lm(formula = phi.N ~ phi.core.frac + Facies - 1, data = datam)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.170805 -0.018003 0.001467 0.020814 0.315570
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## phi.core.frac 0.05055 0.06831 0.740 0.459513
## FaciesF1 0.07729 0.02201 3.511 0.000471 ***
## FaciesF10 0.25232 0.01484 17.007 < 2e-16 ***
## FaciesF2 0.24197 0.02011 12.030 < 2e-16 ***
## FaciesF3 0.20055 0.01716 11.688 < 2e-16 ***
## FaciesF5 0.16426 0.01930 8.510 < 2e-16 ***
## FaciesF7 0.21069 0.02168 9.716 < 2e-16 ***
## FaciesF8 0.24557 0.02140 11.478 < 2e-16 ***
## FaciesF9 0.23493 0.01861 12.621 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.04523 on 810 degrees of freedom
## Multiple R-squared: 0.9628, Adjusted R-squared: 0.9624
## F-statistic: 2327 on 9 and 810 DF, p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(model1)

cporl <- predict(model1,datam)
model2 <- lm( cporl ~ k.core+Facies-1 , data = datam) #We Create second model between corrected core porosity and core permeability with facies
summary(model2)
##
## Call:
## lm(formula = cporl ~ k.core + Facies - 1, data = datam)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0048802 -0.0005783 -0.0000332 0.0005630 0.0050917
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## k.core 2.512e-07 2.487e-08 10.1 <2e-16 ***
## FaciesF1 9.268e-02 1.202e-04 771.3 <2e-16 ***
## FaciesF10 2.628e-01 8.697e-05 3021.8 <2e-16 ***
## FaciesF2 2.509e-01 3.920e-04 640.1 <2e-16 ***
## FaciesF3 2.121e-01 1.519e-04 1396.3 <2e-16 ***
## FaciesF5 1.768e-01 1.708e-04 1035.1 <2e-16 ***
## FaciesF7 2.218e-01 3.722e-04 595.9 <2e-16 ***
## FaciesF8 2.604e-01 1.179e-04 2207.5 <2e-16 ***
## FaciesF9 2.482e-01 8.749e-05 2837.5 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001108 on 810 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 3.876e+06 on 9 and 810 DF, p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(model2)

k.core_log <- predict(model2,datam)
karpur2 <- cbind(datam,k.core_log)
write.csv(karpur2, "karpur2.csv")
par(mfrow=c(1,5))
plot(y=y<-(datam$depth),ylim=rev(range(datam$depth)),x=x<-(datam$phi.N),
type="l", col="darkgreen", lwd = 5, pch=17, xlab='phi.N',
ylab='Depth, m', xlim=c(0.016,0.43), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
plot(y=y<-(datam$depth),ylim=rev(range(datam$depth)),x=x<-(datam$phi.core.frac),
type="l", col="darkred", lwd = 5, pch=17, xlab='phi.core.frac',
ylab='Depth, m', xlim=c(0.16,0.37), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
plot(y=y<-(datam$depth),ylim=rev(range(datam$depth)),x=x<-(cporl),
type="l", col="darkblue", lwd = 5, pch=17, xlab='cporl',
ylab='Depth, m', xlim=c(0.09,0.27), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
plot(y=y<-(datam$depth),ylim=rev(range(datam$depth)),x=x<-(k.core_log),
type="l", col="gold", lwd = 5, pch=17, xlab='k.core_log',
ylab='Depth, m', xlim=c(0.1,0.27), cex=1.5, cex.lab=1.5, cex.axis=1.2)
grid()
boxplot(depth~Facies,data = datam ,range(datam$depth))
