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_hat = 120.07 - 1.93 * parity
If parity is 1 which means the child is not the first born, we would expect 1.93 oz. lower birth weight than first born child.
Since the pvalue is >= 0.05, there is no statistically significant relationship between the average birth weight and parity.
ŷ =18.93−9.11×eth+3.10×sex+2.15×lrn
While other variables are constant, if ethnic = 1 (aboriginal) , we would expect the absenteeism to decrease 9.11
While other variables are constant, if sex = 1 (male) , we would expect the absenteeism to increase 3.10
While other variables are constant, if learner status = 1 (slow learner) , we would expect the absenteeism to increase 2.15.
y = 18.93 - 9.11 * 0 + 3.10 * 1 + 2.15 * 1
residual = 2 - y
residual
## [1] -22.18
The residual for the observation is -22.18
r_sq = 1- 240.57 / 264.17
R^2 = 0.0893364
adj_r_sq = 1- (240.57 / 264.17) * ((146-1)/(146-3-1))
adj_r_sq
## [1] 0.07009704
R^2_adjust = 0.070097
Since removing the learner status has the highest adjusted R square, learnner status should be removed from the model first.
The number of O-rings damaged seems to be strongly correlated with the temperature. The higher the temperature, the lower possibility the O - ring been damaged.
A negative slope indicates a negative association between temperature and damaged O-rings. The associate between temperature and o-ring damage is staticially significant.
log(p/(1-p)) = 11.663−0.2162×temperature
P_50 =exp(11.663-0.2162*50)/(1+exp(11.663-0.2162*50))
According to the model, there will be a high chance of damaged rings under 50 degrees (0.7011961). Since O-rings are critical components to success, the concerns are justified
p_dmg = function(temp){
p=exp(11.663-0.2162*temp)/(1+exp(11.663-0.2162*temp))
return(round(p,3))
}
temp_ls = seq(51,71,2)
probs = p_dmg(temp_ls)
result =data.frame(probs,temp_ls)
result
## probs temp_ls
## 1 0.654 51
## 2 0.551 53
## 3 0.443 55
## 4 0.341 57
## 5 0.251 59
## 6 0.179 61
## 7 0.124 63
## 8 0.084 65
## 9 0.056 67
## 10 0.037 69
## 11 0.024 71
plot(result, type = "b", pch = 19, col = "red")
The conditions for this logistic regression are hard to check.