One-Way ANOVA II

Prof Randi Garcia

2024-09-11

Announcements

  • Homework 1 due on Friday 9/13
  • Homework 2 (due 9/20) will be submitted on Gradescope
    • To be posted on Friday
  • Office hours (Bass 412)
    • Friday 3:00-4:00p

The Meats

The shelf life of meats is the time a prepackaged cut remains salable, safe, and nutritious. Recent studies suggested controlled gas atmospheres as possible alternatives to existing packaging. To test this, beef steaks (75\(g\)) were randomly assigned to packaging with either 1) ambient air in a commercial plastic wrap, 2) vacuum packed, 3) 100% carbon dioxide (\(CO_2\)), or 4) a mixture of 1% carbon monoxide (CO), 40% oxygen (\(O_2\)), and 59% nitrogen (N). The number of psychrotrophic bacteria on the meat was measured after nine days of storage at 4 degrees C.

Confounding Variables

I want to test if smelling a sweet food (fresh cinnamon rolls) versus a non-sweet food (broccoli) has an effect on salivation in humans. So, I recruit some participants to come to my lab, I’ll have to bake the cinnamon rolls and run that condition all at once, so I decide that I will bake my rolls at 9a, then from 10a-12p I will run the cinnamon roll condition. I bring people into individual distraction free rooms, hook them up to the salivation sensor, then bring them a plate with a freshly baked cinnamon roll. I record their salivation. Then, I will run the broccoli condition from 1p-3p, using the exact same measurement procedure.

Are there any issues with my study?

Confounding Variables

Confounding variables vary systematically with the levels of the explanatory factor

Random sampling and random assignment

  • Random sampling (or selection): The sample was chosen randomly from the population.
  • Random assignment: The levels of the experimental factor were randomly assigned to experimental units.

Bias

Our data will be “off” in a systematic, non-random, way

  • Sampling Bias: Biologist is using a net with large holes to capture a sample of fish from a lake.
  • Selection Bias: Assigning the skinnier rats to the good lab chow.

One-Way Analysis of Variance (ANOVA)

  • One factor (explanatory variable) with any number of levels.
  • One quantitative (non-binary) response variable.

One-Way ANOVA

Research question: Are there differences in chalk length estimation across class years?

library(tidyverse)
library(readr)

survey <- read_csv("https://randilgarcia.github.io/sds290fall24/data/class_survey_data.csv")

survey %>%
  select(graduation, chalk_est) %>%
  head()
# A tibble: 6 × 2
  graduation chalk_est
       <dbl>     <dbl>
1       2026      14  
2       2027       6  
3       2027       8.5
4       2025      11.8
5       2025       3  
6       2026      13.5

One-Way ANOVA

qplot(x = chalk_est, data = survey)

Data Cleaning

survey <- survey %>%
  filter(chalk_est < 100)

Data Cleaning

qplot(x = chalk_est, data = survey)

Data Cleaning

survey <- survey %>%
  filter(chalk_est < 40 & !is.na(graduation))

Descriptive statistics for One-Way ANOVA

survey %>%
  group_by(graduation) %>%
  summarise(n = n(),
            mean = mean(chalk_est),
            sd = sd(chalk_est))
# A tibble: 3 × 4
  graduation     n  mean    sd
       <dbl> <int> <dbl> <dbl>
1       2025    18 10.3   6.23
2       2026    13 13.1   2.12
3       2027     6  8.97  2.83

Boxplots for One-Way ANOVA

qplot(x = graduation, y = chalk_est, data = survey, geom = "boxplot")

Boxplots for One-Way ANOVA

qplot(x = factor(graduation), y = chalk_est, data = survey, geom = "boxplot")

Acid Rain

One-Way Design

“Clean” precipitation has a pH in the 5.0 to 5.5 range, but observed precipitation pH in northern New Hampshire is often in the 3.0 to 4.0 range. Is this acid rain hurting trees? 240 six-week-old yellow birch seedlings were randomly assigned to one of 5 groups. Each group received an acid rain mist at the following pH levels: 4.7, 4.0, 3.3, 3.0, and 2.3. After 17 weeks, the seedling were weighed, and their total plant (dry) weight was recorded.

Leafhopper survival

One-Way Design

It is reasonable to assume that the structure of a sugar molecule has something to do with its food value. An experiment was conducted to compare the effects of four sugar diets on the survival of leafhoppers. The four diets were glucose and fructose (6-carbon atoms), sucrose (12-carbon), and a control (2% agar). The experimenter prepared two dishes with each diet, divided the leafhoppers into eight groups of equal size, and then randomly assigned them to dishes. Then she counted the number of days until half the insects had died in each group.

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>

–>