data1<-read.csv("karpur.csv")
head(data1)
plot(data1$phi.N,data1$phi.core.frac)

porosity_model <- lm(phi.core.frac~phi.N+Facies-1,data=data1)
summary(porosity_model)
##
## Call:
## lm(formula = phi.core.frac ~ phi.N + Facies - 1, data = data1)
##
## 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
porosity_corrected<-predict(porosity_model,data1)
pereamibility_model<-lm(data1$k.core~porosity_corrected+Facies-1,data=data1)
summary(pereamibility_model)
##
## Call:
## lm(formula = data1$k.core ~ porosity_corrected + Facies - 1,
## data = data1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5613.4 -596.9 -130.3 475.0 10449.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## porosity_corrected -412352 89814 -4.591 5.11e-06 ***
## FaciesF1 132659 28386 4.673 3.47e-06 ***
## FaciesF10 87869 18969 4.632 4.21e-06 ***
## FaciesF2 73980 16049 4.610 4.69e-06 ***
## FaciesF3 97910 21087 4.643 4.00e-06 ***
## FaciesF5 118916 24729 4.809 1.81e-06 ***
## FaciesF7 95868 20496 4.677 3.40e-06 ***
## FaciesF8 130990 27786 4.714 2.86e-06 ***
## FaciesF9 111324 24050 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
K.corrected<-predict(pereamibility_model)
par(mfrow = c(1,6))
plot(data1$phi.N,data1$depth,type="l",xlim=c(0.0150,0.4100),ylim=rev(c(5667,6083)),xlab="porosity_log",
ylab="depth",col="red",lwd=2)
plot(data1$gamma,data1$depth,type="l",xlim=c(16.74,112.4),ylim=rev(c(5667,6083)),xlab="gamma",
ylab="depth",col="blue",lwd=2)
plot(K.corrected,data1$depth,type="l",ylim=rev(c(5667,6083)),xlim=c(11.26,6280.63),xlab="corrected pereamibility",
ylab="depth",col="green",lwd=2)
plot(data1$k.core,data1$depth,type="l",ylim=rev(c(5667,6083)),xlim=c(0.42,15600),xlab="pereamibility",
ylab="depth",col="brown",lwd=2)
boxplot(depth~Facies , data=data1,col="yellow", ylim=rev(c(5667,6083)))
plot(porosity_corrected,data1$depth,type="l",xlim=c(0.1775,0.3203),ylim=rev(c(5667,6083))
,ylab="depth",xlab="corrected_porosity",lwd=2,col="pink")
