Inference more means

Lecture 22

Dr. Mine Çetinkaya-Rundel

Duke University
STA 101 - Fall 2023

Warm up

Announcements

  • Project 2 / Lab: Make sure to go to your assigned lab section

From last time

Application exercise

Go to Posit Cloud and continue the project titled ae-16-Birth weights.

Inference for comparing two means

Today’s focus

  • Dive into: Inference for comparing two population means, but for groups that are dependent

  • Touch on: Inference for comparing many population means

Setup

library(tidyverse)
library(openintro)
library(tidymodels)
library(ggthemes)

Paired data

Two sets of observations are paired if each observation in one column has a special correspondence or connection with exactly one observation in the other.

Case study: Climate change

Let’s consider a limited set of climate data, examining temperature differences in 1948 vs 2018. 197 locations from the National Oceanic and Atmospheric Administration’s (NOAA) historical data, where the data was available for both years of interest, were sampled. We want to know: is there a difference in the average number of days with temperatures exceeding 90F in 2018 vs. in 1948?

Application exercise

Go to Posit Cloud and continue the project titled ae-17-Climate.

Inference for comparing many means

Case study: Hours to relax or pursue activities that you enjoy

ggplot(gss2010, aes(x = hrsrelax, y = degree)) +
  geom_boxplot()
gss2010 |> 
  group_by(degree) |> 
  summarize(mean(hrsrelax, na.rm = TRUE))
# A tibble: 5 × 2
  degree         `mean(hrsrelax, na.rm = TRUE)`
  <fct>                                   <dbl>
1 BACHELOR                                 3.48
2 GRADUATE                                 3.67
3 HIGH SCHOOL                              3.79
4 JUNIOR COLLEGE                           3.53
5 LT HIGH SCHOOL                           3.73