MSDS Spring 2018

DATA 606 Statistics and Probability for Data Analytics

Jiadi Li

Chapter 7: Introduction to Linear Regression

HW 7: 7.24, 7.26, 7.30, 7.40

7.24 Nutrition at Starbucks, Part I.
The scatterplot below shows the relationship between the number of calories and amount of carbohydrates (in grams) Starbucks food menu items contain.21 Since Starbucks only lists the number of calories on the display items, we are interested in predicting the amount of carbs a menu item has based on its calorie content.

  1. Describe the relationship between number of calories and amount of carbohydrates (in grams) that Starbucks food menu items contain.
    There is positive linear relationship between number of calories and amount of carbohydrates.

  2. In this scenario, what are the explanatory and response variables?
    explanatory - Calories
    response - Carbohydrates

  3. Why might we want to fit a regression line to these data?
    If the linear relationship has a strong strength, we can predict carbohydrates based on calories.

  4. Do these data meet the conditions required for fitting a least squares line?
    To assess whether the linear model is reliable, we need to check for (1) linearity, (2) nearly normal residuals, and (3) constant variability.
    These meet the first two conditions.

7.26 Body measurements, Part III.
Exercise 7.15 introduces data on shoulder girth and height of a group of individuals. The mean shoulder girth is 107.20 cm with a standard deviation of 10.37 cm. The mean height is 171.14 cm with a standard deviation of 9.41 cm. The correlation between height and shoulder girth is 0.67.

  1. Write the equation of the regression line for predicting height.
a1 <- 0.67 * (9.41/10.35)
a0 <- a1 * -107.20 + 171.14

a1
## [1] 0.6091498
a0
## [1] 105.8391

\(y\) = 105.84 + 0.61 \(\times\) shoulder girth

  1. Interpret the slope and the intercept in this context.
    For an additional unit of shoulder girth, there will be an additional 0.6091 unit of height.
    There is 105.84 units of height as baseline even when shoulder girth is 0.

  2. Calculate R2 of the regression line for predicting height from shoulder girth, and interpret it in the context of the application.

R <- 0.67
R^2
## [1] 0.4489
  1. A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.
a0 + a1 * 100
## [1] 166.7541
  1. The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.
abs(a0 + a1 * 100 - 160)
## [1] 6.754122

The residual is the difference in value between observed value and value calculated by formula.

  1. A one year old has a shoulder girth of 56 cm. Would it be appropriate to use this linear model to predict the height of this child?
(56 - a0)/a1
## [1] -81.81756

It’s in appropirate to use this linear model since it’s assumed that the model is for students between 150cm and 200cm in height.

7.30 Cats, Part I.
The following regression output is for predicting the heart weight (in g) of cats from their body weight (in kg). The coe“cients are estimated using a dataset of 144 domestic cats.


(a) Write out the linear model.
heart weight(in g) = -0.357 + 4.034 \(\times\) body wt

  1. Interpret the intercept.
    With a body wt of 0, the heart weight will be -0.357 (theoretically).

  2. Interpret the slope.
    For an additional unit of body wt, there will be an additional unit of heart weight.

  3. Interpret \(R^2\).
    The \(R^2\) value represents the proportion of variability in the response variable that is explained by the explanatory variable. For this model, 64.66% of the variability in heart weight is explained by body wt.

  4. Calculate the correlation coefficient.

sqrt(0.6466)
## [1] 0.8041144

7.40 Rate my professor.
Many college courses conclude by giving students the opportunity to evaluate the course and the instructor anonymously. However, the use of these student evaluations as an indicator of course quality and teaching e???ectiveness is often criticized because these measures may reflect the influence of non-teaching related characteristics, such as the physical appearance of the instructor. Researchers at University of Texas, Austin collected data on teaching evaluation score (higher score means better) and standardized beauty score (a score of 0 means average, negative score means below average, and a positive score means above average) for a sample of 463 professors. The scatterplot below shows the relationship between these variables, and also provided is a regression output for predicting teaching evaluation score from beauty score.

(a) Given that the average standardized beauty score is -0.0883 and average teaching evaluation score is 3.9983, calculate the slope. Alternatively, the slope may be computed using just the information provided in the model summary table.

std.error <- 0.0322
t.value <- 4.13

slope <- std.error * t.value

slope
## [1] 0.132986
  1. Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.
    There isn’t clear trend provided by the graph. The calculated slope verifies the conclusion: the positive correlation is very weak.

  2. List the conditions required for linear regression and check if each one is satisfied for this model based on the following diagnostic plots.

    To assess whether the linear model is reliable, we need to check for (1) linearity, (2) nearly normal residuals, and (3) constant variability.
  1. linearity is not clearly shown;
  2. the histogram of residual shows that the residuals are distributed nearly normally;
  3. constant variability is shown.