On January 28, 1986, a routine launch was anticipated for the Challenger space shuttle. Seventy-three seconds into the flight, disaster happened: the shuttle broke apart, killing all seven crew members on board. An investigation into the cause of the disaster focused on a critical seal called an O-ring, and it is believed that damage to these O-rings during a shuttle launch may be related to the ambient temperature during the launch. The table below summarizes observational data on O-rings for 23 shuttle missions, where the mission order is based on the temperature at the time of the launch.
Format
A data frame with 23 observations on the following 4 variables.
- mission
Shuttle mission number.
- temperature
Temperature, in Fahrenheit.
- damaged
Number of damaged O-rings (out of 6).
- undamaged
Number of undamaged O-rings (out of 6).
Examples
library(dplyr)
library(forcats)
library(tidyr)
library(broom)
# This is a wide data frame. You can convert it to a long
# data frame to predict probability of O-ring damage based
# on temperature using logistic regression.
orings_long <- orings |>
pivot_longer(cols = c(damaged, undamaged), names_to = "outcome", values_to = "n") |>
uncount(n) |>
mutate(outcome = fct_relevel(outcome, "undamaged", "damaged"))
orings_mod <- glm(outcome ~ temperature, data = orings_long, family = "binomial")
tidy(orings_mod)
#> # A tibble: 2 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 11.7 3.30 3.54 0.000403
#> 2 temperature -0.216 0.0532 -4.07 0.0000477