Import data
data = read.csv("karpur.csv")
head(data)
define some required data and convert phi.core to fraction
kcore= data$k.core
phi.N= data$phi.N
phi.core= data$phi.core/100
plot(phi.N,phi.core,main='scatterplot')
mod1=lm(phi.core ~ phi.N )
summary(mod1)
Call:
lm(formula = phi.core ~ phi.N)
Residuals:
Min 1Q Median 3Q
-0.135237 -0.030779 0.009432 0.033563
Max
0.104025
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.30962 0.00485 63.846 <2e-16
phi.N -0.18207 0.02080 -8.753 <2e-16
(Intercept) ***
phi.N ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.04368 on 817 degrees of freedom
Multiple R-squared: 0.08573, Adjusted R-squared: 0.08462
F-statistic: 76.61 on 1 and 817 DF, p-value: < 2.2e-16
##
## Call:
## lm(formula = phi.core ~ phi.N)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.135237 -0.030779 0.009432 0.033563 0.104025
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.30962 0.00485 63.846 <2e-16 ***
## phi.N -0.18207 0.02080 -8.753 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.04368 on 817 degrees of freedom
## Multiple R-squared: 0.08573, Adjusted R-squared: 0.08462
## F-statistic: 76.61 on 1 and 817 DF, p-value: < 2.2e-16
abline(mod1)
phi.core_to_log=predict(mod1)
check that kcore is normal or not
hist(kcore,breaks = 10)
upply log to optain normal distrbution
hist((log(kcore)),breaks = 10)
plot the relationship between phi.core_to_log and log(kcore) and plot best strait line between them
plot(phi.core_to_log,log(kcore),main='scatterplot')
mod2=lm(log(kcore) ~ phi.core_to_log)
abline(mod2)
k_log=predict(mod2)
summary (k_log)
Min. 1st Qu. Median Mean 3rd Qu. Max.
6.057 6.885 6.993 7.128 7.232 8.298