Chapter 8 - Graded

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.

  1. Write the equation of the regression line.

y = mx + c y being baby_weight x being parity The equation is as below. baby_weight = -1.93 * parity + 120.07

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

The slope of the line predicts that it will require -1.93 times for each % increase in weight.

For first borns, baby_weight = -1.93 * 0 + 120.07 = 120.07 For others, baby_weight = -1.93 * 1 + 120.07 = 118.14

  1. Is there a statistically significant relationship between the average birth weight and parity?

P-value shows .10 which explains there is some relationship. But it is not that significantly strong. If P-value is less than .05, then relationship proves to be strong.

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

  1. Write the equation of the regression line.

days = -9.11 * eth + 3.10 * sex + 2.15 * lrn + 18.93

  1. Interpret each one of the slopes in this context.

eth indicates that there is a 9.11 absent days reduction when the individual is not aboriginal.

sex indicates that there is a 3.10 absent days reduction when the individual is male.

lrn indicates that there is a 2.15 absent days increase when the individual is a slow learner.

  1. 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.
eth<-0 # aboriginal
sex<-1 # male
lrn<-1 # slow Learner
missed_days<-2 #actual missed days

predicted_days<- 18.93-9.11*eth+3.1*sex+2.15*lrn

residual<-missed_days-predicted_days
residual
## [1] -22.18
  1. 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 R2 and the adjusted R2. Note that there are 146 observations in the data set.
n<-146 
k<-3   
variance_residual<-240.57
variance_all_students<-264.17

R2<- 1-(variance_residual/variance_all_students)
R2
## [1] 0.08933641
adj_R2 <-1-(variance_residual/variance_all_students)*((n-1)/(n-k-1))
adj_R2
## [1] 0.07009704

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?

If Adjusted R2 is reducing, then that means the model is in-efficient. So looking at that, the first model where Adjusted R square is reducing is when the lrn is removed.