Logistic Regression for Binary Responses The data below are the launch temperatures (degrees F) and an indicator of O-ring failures for 24 space shuttle launches prior to the Challenger disaster of Jan. 27, 1986. The space shuttle has 6 O-rings that can fail, but the dataset below ignores how many of the 6 rings failed for a particular launch. As noted on pg. 86 of your text, engineers warned NASA the night before that the shuttle should not be launched because of predicted cold temperatures. However, NASA decided to launch the Challenger at a temperature of 29F (about -2C). QUESTION: Does there seem to be a higher risk of failure at lower launch temperatures? ######################################################## # The data. "y" indicates an O-ring failure. > shuttle <- data.frame(Temp=c(53,56,57,63,66,67,67,67, 68,69,70,70,70,70,72,73, 75,75,76,76,78,79,80,81), Failure=c("y","y","y","n","n","n","n","n", "n","n","n","y","y","y","n","n", "n","y","n","n","n","n","n","n")) > shuttle[1:3,] Temp Failure 1 53 y 2 56 y 3 57 y Let's plot the data, where "Failure" is the response: > plot(shuttle$Temp,shuttle$Failure, xlab = "Temp", ylab = "2 if fail", main = "O-Ring failure vs. Temperature") > shuttle.fit <- glm(Failure ~ Temp, family = binomial, data = shuttle) > shuttle.fit Call: glm(formula = Failure ~ Temp, family = binomial, data = shuttle) Coefficients: (Intercept) Temp 10.8753 -0.1713 Degrees of Freedom: 23 Total (i.e. Null); 22 Residual Null Deviance: 28.97 Residual Deviance: 23.03 AIC: 27.03 > summary(shuttle.fit) Call: glm(formula = Failure ~ Temp, family = binomial, data = shuttle) Deviance Residuals: Min 1Q Median 3Q Max -1.2125 -0.8253 -0.4705 0.5907 2.0512 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 10.87535 5.70291 1.907 0.0565 . Temp -0.17132 0.08344 -2.053 0.0400 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 28.975 on 23 degrees of freedom Residual deviance: 23.030 on 22 degrees of freedom AIC: 27.030 Number of Fisher Scoring iterations: 4 # Predicted probabilities of failures at each temp. in dataset > fitted(shuttle.fit) 1 2 3 4 5 6 7 0.85758349 0.78268818 0.75214414 0.52052785 0.39369565 0.35362920 0.35362920 8 9 10 11 12 13 14 0.35362920 0.31551837 0.27973723 0.24655222 0.24655222 0.24655222 0.24655222 15 16 17 18 19 20 21 0.18850910 0.16368693 0.12199327 0.12199327 0.10479854 0.10479854 0.07672851 22 23 24 0.06543827 0.05570909 0.04735313 # Predict prob. of O-ring failure at 29F. # WARNING: THIS IS EXTRAPOLATION OUTSIDE OF THE BOUNDS OF THE # ORIGINAL DATASET > predict(shuttle.fit, newdata = data.frame(Temp=29),se.fit=T) # Some output deleted $fit 1 5.907045 # This can't be a probability! It's the log-odds. To get prediction of the probability, add another option: > predict(shuttle.fit, newdata = data.frame(Temp=29),se.fit=T, type = "response") # Some output deleted $fit 1 0.9972872 So P(O-ring failure) is predicted to be over 99% at 29F.