8.2 Baby weights

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.

(a) Write the equation of the regression line.

\[\hat{weight} = 120.07 - 1.93 \times parity\]

(b) Interpret the slope in this context, and calculate the predicted birth weight of first borns and others.

The slope indicates that for every one increase in parity, the weight of a baby goes down by 1.93 ounces.

For first born: \(weight = 120.07 ounces\)

For not first born: \(weight = 120.07 - 1.93 * 1 = 118.14 ounces\)

(c) Is there a statistically significant relationship between the average birth weight and parity?

Since the p-value is 0.1052 which is larger than 0.05, we failed to reject the null hypothesis, hence there is no statistically significant relationship between birth weight and parity.


8.4 Absenteeism, Part I.

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).

(a) Write the equation of the regression line.

\[\hat{absence} = 18.93 - 9.11*eth + 3.1*sex + 2.15*lrn\]

(b) Interpret each one of the slopes in this context.

Given all other factors being the same:

  • Non-aboriginal students miss 9.11 fewer days on average.

  • Male students miss 3.1 more days on average.

  • Slow learners miss 2.15 more days on average.

(c) Calculate the residual for the first observation in the data set: a student who is aboriginal, male, a slow learner, and missed 2 days of school.

\[\hat{absence} = 18.93 - 9.11*0 + 3.1*1 + 2.15*1 = 24.18\]

\[residual = 2 - 24.18 = -22.18\]

(d) The variance of the residuals is 240.57, and the variance of the number of absent days for all students in the data set is 264.17. Calculate the \(R^2\) and the adjusted \(R^2\) . Note that there are 146 observations in the data set.

\[R^2 = 1 - \frac{Var(residuals)}{Var(y)}\] \[R^2 = 1 - \frac{240.57}{264.17} = 0.0893\]

Adjusted \(R^2 = 1 - \frac{Var(residuals)}{Var(y)} \frac{n-1}{n-k-1} = 1 - \frac{240.57}{264.17}\frac{146-1}{146-3-1} = 0.07\)


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.

Which, if any, variable should be removed from the model first?

Since adjusted \(R^2\) increases when learner status is removed, hence learner status should be removed from the model first.


8.16 Challenger disaster, Part I.

(a) Each column of the table above represents a different shuttle mission. Examine these data and describe what you observe with respect to the relationship between temperatures and damaged O-rings.

We observed 8 damaged o-rings below the temperature of 63 degrees Fahrenheit and 3 damaged o-rings above 70 degrees Fahrenheit. Low temperature seems to be associated with o-ring damages.

(b) 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.

The summary table is consisted of the intercept, which is the estimate when degree equals zero. For each increase in degree, there will be decrease in the probability of damaging an O-ring. P-value indicates the possibility of an association between temperature and damage to an O-ring.

(c) Write out the logistic model using the point estimates of the model parameters.

\[ln(\frac{p_i}{1 - p_i}) = 11.6630 - 0.2162 \times Temperature\]

(d) Based on the model, do you think concerns regarding O-rings are justified? Explain.

Yes, a p-value of 0.0000 indicates that there is very high probability that a damaged O-ring is due to low temperature. Since O-rings are critical parts, I believe the concerns regarding O-rings are justified.


8.18 Challenger disaster, Part II.

(a) The data provided in the previous exercise are shown in the plot. The logistic model fit to these data may be written as

\[ln(\frac{\hat{p}}{1 - \hat{p}}) = 11.6630 - 0.2162 \times temperature\]

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:

\[ln(\frac{\hat{p}}{1 - \hat{p}}) = 11.6630 - 0.2162 \times temperature\]

Solving the equation in terms of \(\hat{p}\), we obtain

\[\hat{p} = \frac{e^{11.6630 - 0.2162*temperature}}{1 + e^{11.6630 - 0.2162*temperature}} \]

p <- function(t){
  exp(11.6630-0.2162*t) / (1+ exp(11.6630-0.2162*t))
}

p(51) #temperature = 51
## [1] 0.6540297
p(53) #temperature = 53
## [1] 0.5509228
p(55) #temperature = 55
## [1] 0.4432456
(b) Add the model-estimated probabilities from part (a) on the plot, then connect these dots using a smooth curve to represent the model-estimated probabilities.
t <- c(53,57,58,63,66,67,67,67,68,69,70,70,70,70,72,73,75,75,76,76,78,79,81)
prob <- p(t)
df <- data.frame(t, prob)

library(ggplot2)
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
ggplot(df, aes(x=df$t, y=df$prob)) + 
  geom_point() +
  geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

(c) Describe any concerns you may have regarding applying logistic regression in this application, and note any assumptions that are required to accept the model’s validity.)

My concern is that we do not know if these observations are indepedent to be applied in logistic regression.