setwd("E:/")
reg <- read.csv("reg.csv")
model <- lm(BIO~SAL+pH+K+Na+Zn,data=reg)
pairs(reg)

summary(model)
##
## Call:
## lm(formula = BIO ~ SAL + pH + K + Na + Zn, data = reg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -748.2 -223.7 -85.2 139.9 1072.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.252e+03 1.235e+03 1.014 0.31674
## SAL -3.029e+01 2.403e+01 -1.260 0.21508
## pH 3.055e+02 8.788e+01 3.477 0.00126 **
## K -2.851e-01 3.484e-01 -0.818 0.41817
## Na -8.673e-03 1.593e-02 -0.544 0.58926
## Zn -2.068e+01 1.505e+01 -1.373 0.17746
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 398.3 on 39 degrees of freedom
## Multiple R-squared: 0.6773, Adjusted R-squared: 0.6359
## F-statistic: 16.37 on 5 and 39 DF, p-value: 1.082e-08
anova(model)
## Analysis of Variance Table
##
## Response: BIO
## Df Sum Sq Mean Sq F value Pr(>F)
## SAL 1 204048 204048 1.2864 0.26364
## pH 1 11363668 11363668 71.6399 2.301e-10 ***
## K 1 935178 935178 5.8956 0.01989 *
## Na 1 182599 182599 1.1512 0.28990
## Zn 1 299209 299209 1.8863 0.17746
## Residuals 39 6186262 158622
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(step(model), k = log(45), method = "both")
## Start: AIC=544.4
## BIO ~ SAL + pH + K + Na + Zn
##
## Df Sum of Sq RSS AIC
## - Na 1 47012 6233274 542.74
## - K 1 106210 6292473 543.17
## - SAL 1 251920 6438182 544.20
## <none> 6186262 544.40
## - Zn 1 299209 6485471 544.53
## - pH 1 1917307 8103569 554.55
##
## Step: AIC=542.74
## BIO ~ SAL + pH + K + Zn
##
## Df Sum of Sq RSS AIC
## <none> 6233274 542.74
## - Zn 1 434796 6668070 543.78
## - SAL 1 436496 6669770 543.79
## - K 1 732606 6965880 545.74
## - pH 1 1885805 8119079 552.64
##
## Call:
## lm(formula = BIO ~ SAL + pH + K + Zn, data = reg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -749.1 -229.2 -94.2 127.2 1037.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1505.4882 1133.6940 1.328 0.19172
## SAL -35.9433 21.4761 -1.674 0.10201
## pH 293.8611 84.4738 3.479 0.00123 **
## K -0.4388 0.2024 -2.168 0.03615 *
## Zn -23.4519 14.0399 -1.670 0.10265
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 394.8 on 40 degrees of freedom
## Multiple R-squared: 0.6749, Adjusted R-squared: 0.6423
## F-statistic: 20.76 on 4 and 40 DF, p-value: 2.528e-09