library(DATA606)
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.
bweight = 120.07 - 1.93 * parity
First born babies weighs 1.93 ounces heavier than non-first borns
_First born weight = 120.07_
_Not first born weight = 120.07 - 19.3 = 118.14_
Since the p-value of 0.1052 is greater than 0.05, we cannot reject the null hypothesis and conclude that there is no significant relationship between weight and parity
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.
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).
days_absent = 18.93 - 9.11 * eth + 3.10 * sex + 2.15 * lrn
The ethnic background slope predict that a non-aboriginal student would have a higher average number of days absent
The sex slope predict that a male student would have a higher average number of days absent
The learner status slope predict that a slow learner student would have a higher average number of days absent
days_absent <- 18.93 - (9.11 * 0) + (3.10 * 1) + (2.15 * 1); days_absent
## [1] 24.18
residual <- 2 - days_absent; residual
## [1] -22.18
varE <- 240.57
varY <- 264.17
n <- 146
k <- 3
R2 <- 1 - (varE / varY); R2
## [1] 0.08933641
R2adj <- 1 - ((varE / varY) * (n-1) / (n-k-1)); R2adj
## [1] 0.07009704
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). Which, if any, variable should be removed from the model first?
Having the highest adjusted R2 of 0.0723, learner statu (lrn) should be removed from the model first
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 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.
It appears that of the 23 shuttle missions, the one with lowest temperature had the most number of damaged O-rings
An intercept of 11.6630 suggests the probability of damaged O-rings at 0 temperature. The negative temperature coefficient suggests that an increase of 1 degree in temperature reduces the number of damaged O-rings by 0.2162
log(p/(1-p)) = 116630 - 0.2162 * temperature
Yes, ambient temperature contributes to the number of damaged O-rings and critical to the success/failure of shutlle mission launch
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 takeo off 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.
c_temp <- c(51,53,55)
damaged_prob <- exp(11.6630-(0.2162*c_temp))/(1+exp(11.6630-(0.2162*c_temp)))
damaged_prob
## [1] 0.6540297 0.5509228 0.4432456
temps <- seq(from = 51, to = 81)
predicted_prob <- exp(11.6630-(0.2162*temps))/(1+exp(11.6630-(0.2162*temps)))
dtemp <- as.data.frame(cbind(temps, predicted_prob))
plot(dtemp$temps, dtemp$predicted_prob)