Predicting Chl-a from T-Chla. The regression explains 99% of the varibility, so we can confidently replace missing values with predicted CHL
##
## Call:
## lm(formula = CHL ~ TCHL, data = us)
##
## Residuals:
## Min 1Q Median 3Q Max
## -157.193 -0.466 0.028 0.515 33.651
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.0000799 0.0398553 -0.002 0.998
## TCHL 0.9147471 0.0009575 955.385 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.261 on 10383 degrees of freedom
## (3403 observations deleted due to missingness)
## Multiple R-squared: 0.9888, Adjusted R-squared: 0.9888
## F-statistic: 9.128e+05 on 1 and 10383 DF, p-value: < 2.2e-16
Filter some type in the data (i.e. month =26), missepelling of one lake name (“Whitecell” = “Whitesell”) and log transform predictors.
Do linear regression individually for each lake, plot the intercept and estimate for logTP (slope) for each lake. Then collate the intercept, slope, rsquared and p-value for each lake regression in Lake_LM_sum (see summary table).
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
## The following objects are masked from 'package:base':
##
## crossprod, tcrossprod
## Lake Intercept Estimate
## Length:234 Min. :-20.7673 Min. :-3.8067
## Class :character 1st Qu.: -3.1511 1st Qu.: 0.5355
## Mode :character Median : -1.3141 Median : 1.1049
## Mean : -1.1796 Mean : 1.0404
## 3rd Qu.: 0.4083 3rd Qu.: 1.5864
## Max. : 17.9346 Max. : 5.2941
## Rsq p
## Min. :0.0001646 Min. :0.0000000
## 1st Qu.:0.1607596 1st Qu.:0.0000193
## Median :0.3909025 Median :0.0055715
## Mean :0.4066013 Mean :0.1461939
## 3rd Qu.:0.6320154 3rd Qu.:0.1778342
## Max. :0.9878182 Max. :0.9806943
Filter lakes with slopes <0 (i.e. negative relationships with TP) and plot the CHL:TP ratio in response to NTU+NVSS as a measure of turbidity.