ETC5521 Tutorial 8

Making comparisons between groups and strata


Prof. Di Cook


September 14, 2023

🎯 Objectives

These are exercises so that you can make some numerical and graphical comparisons for various datasets and make you think about the comparisons you are making.

🔧 Preparation

install.packages(c("colorspace", "broom", "patchwork", "janitor", "lubridate", "vcd"))
  • Open your RStudio Project for this unit, (the one you created in week 1, eda or ETC5521). Create a .Rmd document for this week’s activities.

Exercise 1: Melbourne daily maximum temperature

The csv file melb_temp_2023-09-08.csv contains data on the daily maximum temperature from 1970 to 2023 collected from the weather station at Melbourne Airport. Use this to answer the following questions, with the additional information that in Australia:

  • Summer is from the beginning of December to the end of February,
  • Autumn is from the beginning of March to the end of May,
  • Winter is from the beginning of June to the end of August, and
  • Spring is from the beginning of September to the end of November.
  1. There are four plots below. Write the code to make them yourself. Then think about the three questions (i), (ii) or (iii) below.
    1. Are there any winters where the daily maximum temperature is different to winter in other years?
    1. What is the general pattern of maximum daily temperatures in winter?
    1. Is there evidence that winters in Melbourne are getting warmer?

Which plot best matchs each question? If none of them work, for any particular question, make an alternative plot. Also, if any of the plots don’t help answer any of the questions, think about a question that they might answer.

  1. Make a transformation of the data and a new plot with this variable, that will allow a more direct comparison to answer question (iii).

The data can be read and processed using this code:

melb_df <- read_csv("") %>%
  clean_names() %>%
  rename(temp = maximum_temperature_degree_c) %>%
  dplyr::filter(! %>%
  dplyr::select(year, month, day, temp) %>%
    date = as.Date(paste(year, month, day, sep = "-")))