data=read.csv("Desktop/HWW.csv")
model=lm(BIO~SAL+pH+K+Na+Zn,data=data)
summary(model)
## 
## Call:
## lm(formula = BIO ~ SAL + pH + K + Na + Zn, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -748.24 -223.57  -85.13  139.83 1072.32 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  1.252e+03  1.235e+03   1.014  0.31664   
## SAL         -3.029e+01  2.403e+01  -1.260  0.21502   
## pH           3.055e+02  8.788e+01   3.476  0.00126 **
## K           -2.851e-01  3.484e-01  -0.818  0.41817   
## Na          -8.672e-03  1.593e-02  -0.544  0.58926   
## Zn          -2.068e+01  1.505e+01  -1.374  0.17737   
## ---
## 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.6413 2.3e-10 ***
## K          1   935178   935178  5.8958 0.01989 *  
## Na         1   182599   182599  1.1512 0.28990    
## Zn         1   299334   299334  1.8871 0.17737    
## Residuals 39  6186137   158619                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
step(model,direction = "both",k=log(45))
## Start:  AIC=555.24
## BIO ~ SAL + pH + K + Na + Zn
## 
##        Df Sum of Sq     RSS    AIC
## - Na    1     47010 6233148 551.78
## - K     1    106207 6292344 552.20
## - SAL   1    251975 6438112 553.23
## - Zn    1    299334 6485471 553.56
## <none>              6186137 555.24
## - pH    1   1916874 8103012 563.58
## 
## Step:  AIC=551.78
## BIO ~ SAL + pH + K + Zn
## 
##        Df Sum of Sq     RSS    AIC
## - Zn    1    434922 6668070 551.00
## - SAL   1    436545 6669693 551.02
## <none>              6233148 551.78
## - K     1    732563 6965711 552.97
## + Na    1     47010 6186137 555.24
## - pH    1   1885351 8118499 559.86
## 
## Step:  AIC=551
## BIO ~ SAL + pH + K
## 
##        Df Sum of Sq      RSS    AIC
## - SAL   1     88239  6756309 547.79
## <none>               6668070 551.00
## + Zn    1    434922  6233148 551.78
## - K     1    935178  7603247 553.10
## + Na    1    182599  6485471 553.56
## - pH    1  11478835 18146905 592.25
## 
## Step:  AIC=547.79
## BIO ~ pH + K
## 
##        Df Sum of Sq      RSS    AIC
## <none>               6756309 547.79
## - K     1    924266  7680575 549.75
## + Na    1    245075  6511234 549.93
## + SAL   1     88239  6668070 551.00
## + Zn    1     86617  6669693 551.02
## - pH    1  11611782 18368091 588.99
## 
## Call:
## lm(formula = BIO ~ pH + K, data = data)
## 
## Coefficients:
## (Intercept)           pH            K  
##   -506.9774     412.0395      -0.4871