Graded: 8.2, 8.4, 8.8, 8.16, 8.18
Exercise 8.1 introduces a data set on birth weight of babies. Another variable we consider is parity, which is 0 if the child is the first born, and 1 otherwise. The summary table below shows the results of a linear regression model for predicting the average birth weight of babies, measured in ounces, from parity.
\[\hat{y} = 120.07 - 1.93 \times parity\]
If parity equals 1 meaning the child is not the first born, then we would expect a 1.93 oz. lower birth weight than a first born child.
No, the p-value of 0.10 is larger than a 0.05 significance level, so we would not be surprised to get this value by chance alone.
Researchers interested in the relationship between absenteeism from school and certain demographic characteristics of children collected data from 146 randomly sampled students in rural New South Wales, Australia, in a particular school year. Below are three observations from this data set.
The summary table below shows the results of a linear regression model for predicting the average number of days absent based on ethnic background (eth: 0 - aboriginal, 1 - not aboriginal), sex (sex: 0 - female, 1 - male), and learner status (lrn: 0 - average learner, 1 - slow learner).
\[\hat{y} = 18.93 - 9.11 \times eth + 3.10 \times sex + 2.15 \times lrn\]
y = 18.93 - 9.11 * 0 + 3.10 * 1 + 2.15 * 1
# Residual = Observed value - Predicted value
e = 2 - y
The residual for the first observation is -22.18.
r2 <- 1 - 240.57 / 264.17
\[R^2 = 0.0893364\]
adj_r2 <- 1 - (240.57 / 264.17) * ((146-1)/(146-3-1))
\[R^2_{adj} = 0.070097\]
Exercise 8.4 considers a model that predicts the number of days absent using three predictors: ethnic background (eth), gender (sex), and learner status (lrn). The table below shows the adjusted R-squared for the model as well as adjusted R-squared values for all models we evaluate in the first step of the backwards elimination process.
Removing learner status would increase the adjusted \(R^2\) and make the model more accurate.
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. Temp gives the temperature in Fahrenheit, Damaged represents the number of damaged O-rings, and Undamaged represents the number of O-rings that were not damaged.
The number of O-rings damaged seems to be strongly correlated with the temperature. The only mission with more than one damaged O-ring also happens to be the only mission where the temperature fell below 57 degrees Fahrenheit.
A negative slope indicates a negative association between temperature and damaged O-rings. The slope is statistically significant with a p-value of 0. The following formula can be used to determine the probability of damaged O-rings at different temperatures:
\[p_i = \frac{e^{11.663 - 0.2162 \times temp}}{1+e^{11.663 - 0.2162 \times temp}}\]
#probability of damaged O-rings at zero degrees
p_i_0 = exp(11.663)/(1+exp(11.663))
p_i_0
## [1] 0.9999914
#probability of damaged O-rings at 50 degrees
p_i_50 = exp(11.663-0.2162*50)/(1+exp(11.663-0.2162*50))
p_i_50
## [1] 0.7011961
#probability of damaged O-rings at 55 degrees
p_i_55 = exp(11.663-0.2162*55)/(1+exp(11.663-0.2162*55))
p_i_55
## [1] 0.4432456
#probability of damaged O-rings at 60 degrees
p_i_60 = exp(11.663-0.2162*60)/(1+exp(11.663-0.2162*60))
p_i_60
## [1] 0.2126542
\[\log (\frac{p_i}{1-p_i}) = 11.663 - 0.2162 \times temperature\]
Yes, based on the model O-rings are much more likely to become damaged and fail at temperatures below about 60 degrees Fahrenheit. The probability of damage at 60 degrees is about 21.3%, but at 50 degrees the probability of damage is 70.1%.
Exercise 8.16 introduced us to O-rings that were identified as a plausible explanation for the breakup of the Challenger space shuttle 73 seconds into takeoff in 1986. The investigation found that the ambient temperature at the time of the shuttle launch was closely related to the damage of O-rings, which are a critical component of the shuttle. See this earlier exercise if you would like to browse the original data.
where \(\hat{p}\) is the model-estimated probability that an O-ring will become damaged. Use the model to calculate the probability that an O-ring will become damaged at each of the following ambient temperatures: 51, 53, and 55 degrees Fahrenheit. The model-estimated probabilities for several additional ambient temperatures are provided below, where subscripts indicate the temperature:
#probability of damaged O-rings at 51 degrees
p_i_51 = exp(11.663-0.2162*51)/(1+exp(11.663-0.2162*51))
#probability of damaged O-rings at 53 degrees
p_i_53 = exp(11.663-0.2162*53)/(1+exp(11.663-0.2162*53))
#probability of damaged O-rings at 55 degrees
p_i_55 = exp(11.663-0.2162*55)/(1+exp(11.663-0.2162*55))
\[\hat{p}_{51} = 0.654\] \[\hat{p}_{53} = 0.551\] \[\hat{p}_{55} = 0.443\]
temps <- c(seq(51, 71, 2))
p <- exp(11.663-0.2162*temps)/(1+exp(11.663-0.2162*temps))
plot(data.frame(temps, p), type = "b", pch = 19, col = "red")
The conditions for logistic regression are hard to check in this case. The condition that each predictor is linearly related to \(\text{logit}(p_i)\) if all other predictors are held constant is difficult to check with a very limited amount of data additionally we would need to assume independence of outcomes to satisfy the second condition.