- Use multiple regression analysis to study the variation inmercury concentration in largemouth bass living in Florida lakes.The data (bass.csv on Canvas) come from a study of 53 lakes inFlorida sampled from the summer of 1990 to the spring of 1991(Lange, Royals, and Connor 1993). During this time, samples ofwater were taken from the lakes and the follows factors weremeasured: pH, alkalinity, amount of chlorophyll from suspendedplant matter, and the concentration of calcium. At the same time,fish were caught, and their flesh was tested for mercury levels.The response variable is the average mercury level in the flesh ofbass in each of the 53 lakes (avg_mercury). You will use this datato determine if the level of mercury in the fish can be predictedbased on the water chemistry. Import the data and fit the multipleregression model, fitting all possible models.
#question1
library(\"olsrr\")
##
## Attaching package: 'olsrr'
## The following object is masked from'package:datasets':
##
##Â Â Â Â Â rivers
bass =read.csv(\"bass.csv\", header = T)
attach(bass)
bass.lm = lm(Avg_Mercury ~Alkalinity + pH + Calcium+ Chlorophyll, data = bass)
bass.all= ols_step_all_possible(bass.lm)
bass.all
##    IndexN                        Predictors  R-SquareAdj. R-Square
## 1Â Â Â Â Â Â 11Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Alkalinity0.4254905Â Â Â Â Â 0.4142256
## 2Â Â Â Â Â Â 21Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pH0.3310853Â Â Â Â Â 0.3179693
## 3Â Â Â Â Â Â 31Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Calcium0.2386129Â Â Â Â Â 0.2236838
## 4Â Â Â Â Â Â 41Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Chlorophyll0.2130176Â Â Â Â Â 0.1975865
## 6Â Â Â Â Â Â 52Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AlkalinityCalcium 0.4478582Â Â Â Â Â 0.4257726
## 7Â Â Â Â Â Â 62Â Â Â Â Â Â Â Â Â Â Â Â AlkalinityChlorophyll 0.4436411Â Â Â Â Â 0.4213868
## 5Â Â Â Â Â Â 72Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AlkalinitypH 0.4292584Â Â Â Â Â 0.4064287
## 9Â Â Â Â Â Â 82Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pHChlorophyll 0.3444788Â Â Â Â Â 0.3182580
## 8Â Â Â Â Â Â 92Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pHCalcium 0.3348995Â Â Â Â Â 0.3082955
## 10Â Â Â Â 102Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â CalciumChlorophyll 0.3009248Â Â Â Â Â 0.2729618
## 13Â Â Â Â 11 3Â Â Â Â AlkalinityCalcium Chlorophyll0.4705171Â Â Â Â Â 0.4380997
## 11Â Â Â Â 123Â Â Â Â Â Â Â Â Â Â Â Â Â AlkalinitypH Calcium 0.4576077Â Â Â Â Â 0.4244001
## 12Â Â Â Â 133Â Â Â Â Â Â Â Â Â AlkalinitypH Chlorophyll0.4436478Â Â Â Â Â 0.4095855
## 14Â Â Â Â 143Â Â Â Â Â Â Â Â Â Â Â Â pHCalcium Chlorophyll0.3484270Â Â Â Â Â 0.3085347
## 15Â Â Â Â 15 4 Alkalinity pH Calcium Chlorophyll0.4719492Â Â Â Â Â 0.4279450
##Â Â Â Â Mallow's Cp
## 1Â Â Â Â Â 3.223111
## 2Â Â Â Â 11.804576
## 3Â Â Â Â 20.210347
## 4Â Â Â Â 22.536973
## 6Â Â Â Â Â 3.189877
## 7Â Â Â Â Â 3.573211
## 5Â Â Â Â Â 4.880607
## 9Â Â Â Â 12.587099
## 8Â Â Â Â 13.457860
## 10Â Â Â 16.546176
## 13Â Â Â Â 3.130182
## 11Â Â Â Â 4.303642
## 12Â Â Â Â 5.572602
## 14Â Â Â 14.228213
## 15Â Â Â Â 5.000000
plot(bass.all)
detach(bass)
a. Give the ??2 and Adjusted??2 forthe best models with one, two, three, and four predictors. Commenton these results (include the variables involved.)
b. Suppose that you want to predictthe average mercury level of fish in a new lake with alkalinity3.0, calcium 2.5, chlorophyll 2.5, and pH 6.0. The predicted valuefor the model including all four predictors is .545 (.0164, 1.073)[mean (PI).] The predicted value for the modelincluding only alkalinity, calcium, and chlorophyll is .532 (.0133,1.051). Have the predicted values and the prediction intervalschanged considerably between the two models? Explain why or why not(based on the inspection of these results.)
c. Explain how your results of a) andb) agree.