#STEP 1: LOAD IN NECESSARY PACKAGES TO PERFORM ANALYSIS
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.3.3
## Warning: package 'ggplot2' was built under R version 4.3.3
## Warning: package 'tibble' was built under R version 4.3.3
## Warning: package 'tidyr' was built under R version 4.3.3
## Warning: package 'readr' was built under R version 4.3.3
## Warning: package 'purrr' was built under R version 4.3.3
## Warning: package 'dplyr' was built under R version 4.3.3
## Warning: package 'stringr' was built under R version 4.3.3
## Warning: package 'forcats' was built under R version 4.3.3
## Warning: package 'lubridate' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.0 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
## Warning: package 'readxl' was built under R version 4.3.3
library(lme4)
## Warning: package 'lme4' was built under R version 4.3.3
## Loading required package: Matrix
## Warning: package 'Matrix' was built under R version 4.3.3
##
## Attaching package: 'Matrix'
##
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
# STEP 2: IMPORT DATASET
SAVtcL <- read.csv(file = "C:/Users/k_hem/OneDrive/Desktop/UMN AV Data/SAVfinal.csv")
levels2 <- c("pre", "post") # CREATE DATAFRAME TO ASSIGN LEVELS
SAVtcL$period2 <- factor(SAVtcL$period2, levels = levels2) # ASSIGN PRE AND POST LEVELS TO SET PRE AS REFERENCE LEVEL
# STEP 3: ARE INDIVIDUAL LAKES EXPERIENCING AN INCREASE OR DECREASE IN THE PLANT COMMUNITY (REGARDLESS OF NATIVE OR INVASIVE) FOLLOWING ALUM TREATMENTS?
# STEP 3.1: BASS LAKE
bass <- SAVtcL %>% filter(lake_name == 'Bass') # FILTER FOR JUST BASS LAKE
t.test(FoC_tot ~ period2, data = bass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -1.6768, df = 4.2902, p-value = 0.164
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.6019251 0.1411326
## sample estimates:
## mean in group pre mean in group post
## 0.4896794 0.7200756
# BASS LAKE: There is no statistically significant evidence to suggest a difference in means between the "pre" and "post" groups, the observed difference in means could be due to random variation rather than a true underlying effect.
# STEP 3.1: BASS LAKE
bass <- SAVtcL %>% filter(lake_name == 'Bass') # FILTER FOR JUST BASS LAKE
bmodel <- lmer(FoC_tot ~ period2 + (1| lake_name), data = SAVtcL)
summary(bmodel)
## Linear mixed model fit by REML ['lmerMod']
## Formula: FoC_tot ~ period2 + (1 | lake_name)
## Data: SAVtcL
##
## REML criterion at convergence: -73.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9408 -0.4967 0.0876 0.7689 2.7121
##
## Random effects:
## Groups Name Variance Std.Dev.
## lake_name (Intercept) 0.02026 0.1423
## Residual 0.03345 0.1829
## Number of obs: 177, groups: lake_name, 7
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.63240 0.05842 10.825
## period2post 0.10876 0.02911 3.736
##
## Correlation of Fixed Effects:
## (Intr)
## period2post -0.286
isSingular(bmodel)
## [1] FALSE
# STEP 3.2: HALF MOON LAKE
halfmoon <- SAVtcL %>% filter(lake_name == 'Halfmoon') # FILTER FOR JUST HALF MOON LAKE
t.test(FoC_tot ~ period2, data = halfmoon) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -1.5787, df = 6.6448, p-value = 0.1607
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.41613699 0.08511156
## sample estimates:
## mean in group pre mean in group post
## 0.4626120 0.6281247
# HALF MOON LAKE: There is no statistically significant difference in means between the "pre" and "post" groups for the variable FoC_tot
# STEP 3.3: HYLAND LAKE
hyland <- SAVtcL %>% filter(lake_name == 'Hyland') # FILTER FOR JUST HYLAND
t.test(FoC_tot ~ period2, data = hyland) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -0.16157, df = 19.271, p-value = 0.8733
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.2081076 0.1782534
## sample estimates:
## mean in group pre mean in group post
## 0.4875453 0.5024724
# HYLAND LAKE: There is no statistically significant difference in means between the "pre" and "post" groups for the variable FoC_tot
# STEP 3.4: KELLER LAKE
keller <- SAVtcL %>% filter(lake_name == 'Keller') # FILTER FOR JUST KELLER
t.test(FoC_tot ~ period2, data = keller) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -1.1945, df = 25.995, p-value = 0.2431
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.26976038 0.07146583
## sample estimates:
## mean in group pre mean in group post
## 0.7583466 0.8574939
# KELLER LAKE: There is no statistically significant difference in means between the "pre" and "post" groups for the variable FoC_tot
# STEP 3.5: LONG LAKE
long <- SAVtcL %>% filter(lake_name == 'Long') # FILTER FOR JUST HALF MOON LAKE
t.test(FoC_tot ~ period2, data = long) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -3.3919, df = 2.8092, p-value = 0.04714
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.7385654 -0.0092170
## sample estimates:
## mean in group pre mean in group post
## 0.4043441 0.7782353
# LONG LAKE: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 3.6: LAKE RILEY
riley <- SAVtcL %>% filter(lake_name == 'Riley') # FILTER FOR JUST HALF MOON LAKE
t.test(FoC_tot ~ period2, data = riley) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -4.6624, df = 26.959, p-value = 7.571e-05
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.22906262 -0.08905551
## sample estimates:
## mean in group pre mean in group post
## 0.6547911 0.8138502
# LAKE RILEY: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 3.7: WASSERMANN LAKE
wass <- SAVtcL %>% filter(lake_name == 'Wassermann') # FILTER FOR JUST HALF MOON LAKE
t.test(FoC_tot ~ period2, data = wass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_tot by period2
## t = -0.30134, df = 16.113, p-value = 0.767
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.07490138 0.05624818
## sample estimates:
## mean in group pre mean in group post
## 0.9242028 0.9335294
# WASSERMANN LAKE: There is no statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group.
# STEP 4: ARE INDIVIDUAL LAKES EXPEREINCING A DECREASE OR INCREASE IN THE NATIVE PLANT COMMUNITY?
# STEP 4.1: BASS LAKE
t.test(FoC_Nat ~ period2, data = bass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -2.5826, df = 7.0857, p-value = 0.03596
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.51837839 -0.02347245
## sample estimates:
## mean in group pre mean in group post
## 0.3971874 0.6681128
# BASS LAKE: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 4.2: HALF MOON LAKE
t.test(FoC_Nat ~ period2, data = halfmoon) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -4.3916, df = 10.267, p-value = 0.00127
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.4319357 -0.1418426
## sample estimates:
## mean in group pre mean in group post
## 0.3292094 0.6160986
# HALF MOON LAKE: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 4.3: HYLAND LAKE
t.test(FoC_Nat ~ period2, data = hyland) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = 0.8197, df = 23.775, p-value = 0.4205
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.09121211 0.21129729
## sample estimates:
## mean in group pre mean in group post
## 0.3939171 0.3338745
# HYLAND LAKE: There is no statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group.
# STEP 4.4: KELLER LAKE
t.test(FoC_Nat ~ period2, data = keller) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -4.8688, df = 25.046, p-value = 5.21e-05
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.5456172 -0.2212566
## sample estimates:
## mean in group pre mean in group post
## 0.4101749 0.7936118
# KELLER LAKE: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 4.5: LONG LAKE
t.test(FoC_Nat ~ period2, data = long) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -3.2611, df = 2.6677, p-value = 0.05563
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.74156374 0.01752374
## sample estimates:
## mean in group pre mean in group post
## 0.4005819 0.7626019
# LONG LAKE: There is no statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 4.6: LAKE RILEY
t.test(FoC_Nat ~ period2, data = riley) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -7.4446, df = 31.838, p-value = 1.854e-08
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.3310980 -0.1888152
## sample estimates:
## mean in group pre mean in group post
## 0.5180265 0.7779831
# LAKE RILEY: There is statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group, the difference in means is unlikely to be due to random variation alone.
# STEP 4.7: WASSERMANN LAKE
t.test(FoC_Nat ~ period2, data = wass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Nat by period2
## t = -0.59077, df = 23.349, p-value = 0.5604
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.15750001 0.08748033
## sample estimates:
## mean in group pre mean in group post
## 0.7487416 0.7837514
# WASSERMANN LAKE: There is no statistically significant evidence to suggest that the mean of the "post" group is higher than that of the "pre" group.
# STEP 5: ARE INDIVIDUAL LAKES EXPERIENCING A DECREASE OR INCREASE IN CURLY-LEAF PONDWEED?
# STEP 5.1: BASS LAKE
t.test(FoC_Pcri ~ period2, data = bass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = 0.57608, df = 6.1301, p-value = 0.5851
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.2895046 0.4690014
## sample estimates:
## mean in group pre mean in group post
## 0.2079643 0.1182159
# BASS LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.2: HALF MOON LAKE
t.test(FoC_Pcri ~ period2, data = halfmoon) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = 1.81, df = 5.2617, p-value = 0.1272
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.08349598 0.50181923
## sample estimates:
## mean in group pre mean in group post
## 0.24892272 0.03976109
# HALF MOON LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.3: HYLAND LAKE
t.test(FoC_Pcri ~ period2, data = hyland) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = -0.93597, df = 17.001, p-value = 0.3624
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.3507663 0.1351854
## sample estimates:
## mean in group pre mean in group post
## 0.1561167 0.2639072
# HYLAND LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.4: KELLER LAKE
t.test(FoC_Pcri ~ period2, data = keller) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = 1.9736, df = 25.419, p-value = 0.05939
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.01046297 0.50070723
## sample estimates:
## mean in group pre mean in group post
## 0.3704293 0.1253071
# KELLER LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.5: LONG LAKE
t.test(FoC_Pcri ~ period2, data = long) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = -2.8642, df = 5.5269, p-value = 0.03142
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.32973705 -0.02248144
## sample estimates:
## mean in group pre mean in group post
## 0.02924838 0.20535763
# LONG LAKE: There is a statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.6: LAKE RILEY
t.test(FoC_Pcri ~ period2, data = riley) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = 0.51861, df = 21.456, p-value = 0.6093
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.09652033 0.16076490
## sample estimates:
## mean in group pre mean in group post
## 0.2105831 0.1784608
# RILEY LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 5.7: WASSERMANN LAKE
t.test(FoC_Pcri ~ period2, data = wass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Pcri by period2
## t = 1.1076, df = 23.867, p-value = 0.2791
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.1142514 0.3787551
## sample estimates:
## mean in group pre mean in group post
## 0.4307330 0.2984812
# RILEY LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 6: ARE INDIVIDUAL LAKES EXPERIENCING A DECREASE OR INCREASE IN EURASIAN WATERMILFOIL?
# NOTE NOT ALL LAKES HAVE EURASIAN WATERMILFOIL PRESENT
# STEP 6.1: HYLAND LAKE
t.test(FoC_Mspi ~ period2, data = hyland) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Mspi by period2
## t = 1, df = 20, p-value = 0.3293
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.0004137004 0.0011756051
## sample estimates:
## mean in group pre mean in group post
## 0.0003809524 0.0000000000
# HYLAND LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 6.2: KELLER LAKE
t.test(FoC_Mspi ~ period2, data = keller) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Mspi by period2
## t = -1.6202, df = 15.368, p-value = 0.1255
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.53449415 0.07228863
## sample estimates:
## mean in group pre mean in group post
## 0.2750397 0.5061425
# KELLER LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
# STEP 6.3: LAKE RILEY
t.test(FoC_Mspi ~ period2, data = riley) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Mspi by period2
## t = 2.6995, df = 29.493, p-value = 0.01138
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 0.04012595 0.29022730
## sample estimates:
## mean in group pre mean in group post
## 0.3342426 0.1690659
# LAKE RILEY: There is a statistically significant difference in means between the "pre" and "post" groups. The "pre" group has a significantly higher mean than the "post" group
# STEP 6.4: WASSERMANN LAKE
t.test(FoC_Mspi ~ period2, data = wass) # PERFORM T-TEST
##
## Welch Two Sample t-test
##
## data: FoC_Mspi by period2
## t = -1.569, df = 16.737, p-value = 0.1354
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.22111947 0.03263609
## sample estimates:
## mean in group pre mean in group post
## 0.4620342 0.5562759
# WASSERMANN LAKE: There is no statistically significant difference in means between the "pre" and "post" groups.
#STEP 7: SET UP DATA
#STEP 7.1: IMPORT DATA
WQSAVL <- read.csv("C:/Users/k_hem/OneDrive/Desktop/UMN WQ Data/WaterQualityFix.csv")
#STEP 7.2: ASSIGN PRE AND POST ALUM TREATMENT INTO A NEW COLUMN: PERIOD2
WQSAVL$period2 <- ifelse(WQSAVL$period == "pre", "pre", "post")
# STEP 7.3: ENSURE PRE IS THE REFERENCE LEVEL
levels2 <- c("pre", "post") # CREATE DATAFRAME TO ASSIGN LEVELS
WQSAVL$period2 <- factor(WQSAVL$period2, levels = levels2) # ASSIGN PRE AND POST LEVELS TO SET PRE AS REFERENCE LEVEL
#STEP 8: T-TESTS FOR WATER QUALITY
#STEP 8.1: BASS LAKE
b2 <- WQSAVL %>% filter(lake_name == 'Bass') # FILTER FOR JUST BASS LAKE
t.test(tp ~ period2, data = b2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 4.3409, df = 48.046, p-value = 7.277e-05
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 73.20984 199.54155
## sample estimates:
## mean in group pre mean in group post
## 171.26458 34.88889
t.test(secchi ~ period2, data = b2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -4.4867, df = 208.68, p-value = 1.195e-05
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -1.0340072 -0.4027213
## sample estimates:
## mean in group pre mean in group post
## 1.575536 2.293900
#STEP 8.2: HALF MOON LAKE
hm2 <- WQSAVL %>% filter(lake_name == 'Half_Moon')
t.test(tp ~ period2, data = hm2) # NO SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 0.56713, df = 13.703, p-value = 0.5798
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -8.092568 13.894714
## sample estimates:
## mean in group pre mean in group post
## 37.35119 34.45012
t.test(secchi ~ period2, data = hm2) # NO SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = 1.0296, df = 16.62, p-value = 0.3179
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.1467753 0.4256260
## sample estimates:
## mean in group pre mean in group post
## 1.769821 1.630396
#STEP 8.3: HYLAND LAKE
h2 <- WQSAVL %>% filter(lake_name == 'Hyland')
t.test(tp ~ period2, data = h2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 8.4063, df = 121.3, p-value = 9.526e-14
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 34.34090 55.49852
## sample estimates:
## mean in group pre mean in group post
## 81.62193 36.70222
t.test(secchi ~ period2, data = h2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -2.8861, df = 143.74, p-value = 0.004503
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.6390924 -0.1195288
## sample estimates:
## mean in group pre mean in group post
## 1.273523 1.652833
#STEP 8.4: KELLER LAKE
k2 <- WQSAVL %>% filter(lake_name == 'Keller')
t.test(tp ~ period2, data = k2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 12.23, df = 122.89, p-value < 2.2e-16
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 43.00284 59.61175
## sample estimates:
## mean in group pre mean in group post
## 90.23457 38.92727
t.test(secchi ~ period2, data = k2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -6.6107, df = 116.84, p-value = 1.199e-09
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.7517890 -0.4051776
## sample estimates:
## mean in group pre mean in group post
## 0.7403846 1.3188679
#STEP 8.5: LONG LAKE
l2 <- WQSAVL %>% filter(lake_name == 'Long')
t.test(tp ~ period2, data = l2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 4.5042, df = 21.67, p-value = 0.0001819
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 37.71468 102.18532
## sample estimates:
## mean in group pre mean in group post
## 102.95 33.00
t.test(secchi ~ period2, data = l2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -2.9855, df = 87.383, p-value = 0.003672
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -0.8879981 -0.1782097
## sample estimates:
## mean in group pre mean in group post
## 1.740426 2.273529
#STEP 8.6: LAKE RILEY
r2 <- WQSAVL %>% filter(lake_name == 'Riley')
t.test(tp ~ period2, data = r2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 9.2489, df = 35.842, p-value = 5e-11
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 21.48589 33.55766
## sample estimates:
## mean in group pre mean in group post
## 49.75862 22.23684
t.test(secchi ~ period2, data = r2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -6.4131, df = 107.53, p-value = 3.907e-09
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -2.227724 -1.175729
## sample estimates:
## mean in group pre mean in group post
## 2.135490 3.837216
#STEP 8.7: WASSERMANN LAKE
w2 <- WQSAVL %>% filter(lake_name == 'Wassermann')
t.test(tp ~ period2, data = w2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: tp by period2
## t = 7.5488, df = 53.225, p-value = 5.763e-10
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## 22.61937 38.98664
## sample estimates:
## mean in group pre mean in group post
## 70.23158 39.42857
t.test(secchi ~ period2, data = w2) #SIG CHANGE
##
## Welch Two Sample t-test
##
## data: secchi by period2
## t = -2.287, df = 38.036, p-value = 0.02785
## alternative hypothesis: true difference in means between group pre and group post is not equal to 0
## 95 percent confidence interval:
## -1.18288707 -0.07205917
## sample estimates:
## mean in group pre mean in group post
## 1.190860 1.818333
sessionInfo()
## R version 4.2.2 (2022-10-31 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 22621)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.utf8
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] lme4_1.1-35.1 Matrix_1.6-5 readxl_1.4.3 lubridate_1.9.3
## [5] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
## [9] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.0
## [13] tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.1 xfun_0.42 bslib_0.6.1 splines_4.2.2
## [5] lattice_0.20-45 colorspace_2.1-0 vctrs_0.6.5 generics_0.1.3
## [9] htmltools_0.5.7 yaml_2.3.8 utf8_1.2.4 rlang_1.1.3
## [13] nloptr_2.0.3 jquerylib_0.1.4 pillar_1.9.0 glue_1.7.0
## [17] withr_3.0.0 lifecycle_1.0.4 munsell_0.5.0 gtable_0.3.4
## [21] cellranger_1.1.0 evaluate_0.23 knitr_1.45 tzdb_0.4.0
## [25] fastmap_1.1.1 fansi_1.0.6 Rcpp_1.0.12 scales_1.3.0
## [29] cachem_1.0.8 jsonlite_1.8.8 hms_1.1.3 digest_0.6.35
## [33] stringi_1.8.3 grid_4.2.2 cli_3.6.2 tools_4.2.2
## [37] magrittr_2.0.3 sass_0.4.9 pkgconfig_2.0.3 MASS_7.3-58.1
## [41] timechange_0.3.0 minqa_1.2.6 rmarkdown_2.26 rstudioapi_0.15.0
## [45] R6_2.5.1 boot_1.3-30 nlme_3.1-160 compiler_4.2.2