The goal of this assignment is to analyze data from Ted Ozersky using the approaches for comparing two samples using some sort of T-Test. Note you may need to use a Two Sample T-Test with or without equal variances, a paired t-Test on the original data or transformed data.
The set up for the analyses - load libraries - read in the data - make transformations up front in this case - you might thing through this and name things so you can copy the whole code chunk for each question ; )
# load the librarieslibrary(broom) # for cleaning statisical model outputslibrary(car) # For diagnostic tests
Loading required package: carData
library(skimr) # summary stats if you wantlibrary(patchwork) # combining graphslibrary(tidyverse) # needed for almost all of the code and plotting
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
✖ dplyr::recode() masks car::recode()
✖ purrr::some() masks car::some()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# # read in data and do transforms# # read in the long formatted data - the origina.# l_df <- read_csv("data/chl_p_data_assignment_01.csv")# # # # in some tests you need to transform the data to a wide format. # # I have provided a wide format data set so you dont need to do this.# # The code below will transform the data into a wide formated dataset# # # Long to Wide dataframe --- # season_df <- l_df %>%# pivot_wider(# names_from = season,# values_from = c(tp_ugl, phytobiomass_mgl),# names_sep = "_"# ) # # # read in the wide formated data # # season_df <- read_csv("data/chl_p_data_assignment_wide_01b.csv")# # # # transform variables using a log base 10 transform# l_df <- l_df %>% mutate(log_tp_ugl = log10(tp_ugl),# log_phytobiomass = log10(phytobiomass_mgl))# # # transform the data in the season dataframe# season_df <- season_df %>% # mutate(# log_tp_ugl_winter = log10(tp_ugl_winter),# log_tp_ugl_summer = log10(tp_ugl_summer),# log_phytobiomass_mgl_winter = log10(phytobiomass_mgl_winter),# log_phytobiomass_mgl_summer = log10(phytobiomass_mgl_summer),# )
Question 1: Hypothesis statements:
Question 1: is there a difference in total phosphorus concentrations between winter and summer?
Ho: µ𝚫TPsummer-winter = 0
Ha: µ𝚫TPsummer-winter ≠ 0
The null hypothesis tested is that the population mean difference between summer and winter TP values is equal to 0. The alternative hypothesis is that the population mean difference between summer and winter TP values is not equal to zero.