library(ggplot2)
8.2 Baby weights, Part II. 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.
\(y=120-1.93x\)
The predicte birth weight of first borns is 120 ounces. Each successive child is estimated to be 1.93 ounces less than the previous child born to the same parents.
No, the p-value is \(.1052 > .05\), which is not a statistically significant p-value.
8.4 Absenteeism. 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.
eth sex lrn days
1 0 1 1 2 2 0 1 1 11 … 146 1 0 0 37
\(y=18.93-9.11eth +3.10sex + 2.15lrn\)
Ethinicity has a statistically significant p-value, and the slope indicates that, on average, aboriginal students miss 9 more days of school than non-aboriginal students. Sex and learning ability do not have statistically significant p-values, but they imply that male students miss 3 more days on average and slow learning students miss 2 more days on average.
\(y=18.93-9.11(0) +3.10(1) + 2.15(1)=24.18\) is the estimated days missed. So the residual would be \(2-24.18=-22.18\).
\(R^2=1-\frac{240.57}{264.17}=.08933641\)
adjusted: \(R^2_{adjusted}=1-\frac{240.57}{264.17}*\frac{(n-1)}{(n-k-1)}=1-\frac{240.57}{264.17}*\frac{145}{142}= 0.070097\)
where n=number of observations and k=number of variables.
8.8 Absenteeism, Part II. 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. Model Adjusted \(R^2\) 1 Full model 0.0701 2 No ethnicity -0.0033 3 No sex 0.0676 4 No learner status 0.0723
Which, if any, variable should be removed from the model first?
The model would improve if the learner status variable was removed, because the adjusted \(R^2\) value when this variable is removed is higher than the original model’s \(R^2\) value.
8.16 Challenger disaster, Part I. 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.
ShuttleMission 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Temperature 53 57 58 63 66 67 67 67 68 69 70 70 70 70 72 73 75 75 76 76 78 79 81 Damaged 5 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 Undamaged 1 5 5 5 6 6 6 6 6 6 5 6 5 6 6 6 6 5 6 6 6 6 6
At a glance, it appears the damaged o-rings occur at lower temperatures. This could be the contrast between the shuttle and the air temperature, among many other situations.
Failures have been coded as 1 for a damaged O-ring and 0 for an undamaged O-ring, and a logistic regression model was fit to these data. A summary of this model is given below. Describe the key components of this summary table in words.
Estimate Std. Error z value Pr(>|z|)
(Intercept) 11.6630 3.2963 3.54 0.0004 Temperature -0.2162 0.0532 -4.07 0.0000
When the ambient temperature is 0 degrees Farenheit, there will be an estimated 11 damaged O-rings. As temperature increases by 1 degree Farenheit, the number of damaged O-rings will decrease by .2162. These are both statistically significant variables.
\(y=11.6630-.2162x\)
Yes, since the P-value is <.01, there is evidence that there is a relationship between the damaged O-rings and the change in temperature. This is something that should be fixed, since the temperature drops the further you get from Earth.
8.18 Challenger disaster, Part II. 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 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: \(p_{57}=0.341\) \(p_{59}=0.251\) \(p_{61} = 0.179\) \(p_{63} = 0.124\) \(p_{65} = 0.084\) \(p_{67} = 0.056\) \(p_{69} = 0.037\) \(p_{71} = 0.024\)
Temperature <- c(51, 53, 55)
p <- exp(11.6630-0.2162*Temperature)/(exp(11.6630-0.2162*Temperature)+1)
p
## [1] 0.6540297 0.5509228 0.4432456
So we can see that \(p_{51}=0.6540297\) \(p_{53}=0.5509228\) \(p_{55}=0.4432456\)
temp <- c(51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71)
prob <- c(0.6540297, 0.5509228, 0.4432456, 0.341, 0.251, 0.179, 0.124, 0.084, 0.056, 0.037, 0.024)
Oringdata <-as.data.frame(cbind(temp, prob))
Oringdata
## temp prob
## 1 51 0.6540297
## 2 53 0.5509228
## 3 55 0.4432456
## 4 57 0.3410000
## 5 59 0.2510000
## 6 61 0.1790000
## 7 63 0.1240000
## 8 65 0.0840000
## 9 67 0.0560000
## 10 69 0.0370000
## 11 71 0.0240000
ggplot(Oringdata, aes(x=temp, y=prob)) + geom_point() + stat_smooth(method = 'glm')
We are assuming the observations are independent, and we don’t have enough observations to be confident that this model is accurate.