name date tmax tmin tavg year month day Bureau 1869-01-01 25 21 23 1869 Jan 1 Bureau…
- User
name date tmax tmin tavg year month day Bureau 1869-01-01 25 21 23 1869 Jan 1 Bureau 1869-01-02 30 22 26 1869 Jan 2 Bureau 1869-01-03 37 30 33.5 1869 Jan 3 Bureau 1869-01-04 35 22 28.5 1869 Jan 4 Bureau 1869-01-05 25 18 21.5 1869 Jan 5 Bureau 1869-01-06 42 26 34 1869 Jan 6 Bureau 1869-01-07 40 29 34.5 1869 Jan 7 Bureau 1869-01-08 29 23 26 1869 Jan 8 Bureau 1869-01-09 23 9 16 1869 Jan 9 Bureau 1869-01-10 13 0 6.5 1869 Jan 10 Bureau 1869-01-11 11 -5 3 1869 Jan 11 Bureau 1869-01-12 25 9 17 1869 Jan 12 Bureau 1869-01-13 34 25 29.5 1869 Jan 13 Bureau 1869-01-14 33 20 26.5 1869 Jan 14 This is the weather file
I have done this
Data
The following code reads in the Madison weather data and calculates the average July temperature for each year. Treat the years from 1869 to 1898 as early Madison and from 1991 to 2020 as recent Madison.
## Read and transform the Madison weather data mw = read_csv("../../data/madison-weather-2020-clean-2.csv") mw_july = mw %>% filter(month=="Jul") %>% filter(year < 1899 | year > 1990) %>% group_by(year) %>% summarize(tavg = mean(tavg)) %>% mutate(era = case_when( year < 1900 ~ "early", year > 1989 ~ "recent"))Write these for me
1
Calculate the mean and standard deviation of the average July temperature separately for early Madison and recent Madison.
# insert code here2
Make a plot with separate density curves for the early and recent July average temperatures.
# insert code here3
Treat the 30 years in each time period as separate samples. Find 95% confidence intervals for the average July temperature in each time period. Compare results with the output of the
t.test().# insert code here4
Draw a graph of a t distribution with 29 degrees of freedom and with the middle 95% of the distribution shaded in.
# insert code here5
Find a 95% confidence interval for the change (recent minus early) of average July temperatures in Madison. Do this first using R, then (optionally) verify by manual computation (note you can get the degrees of freedom from the R
t.testoutput).# insert code here6
Test the hypothesis that the mean July temperature in Madison in the early era is equal to that in the recent era versus that alternative that they are different. Calculate the test statistic from the equations and verify it matches the result from . Write a conclusion in context to interpret the result of this hypothesis test.
- Assistant