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

    Number of calories and amount of carbohydrates have a direct relationship.

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

    The explanatory variable is calorie content and the response variable is amount of carbs.

  3. Why might we want to fit a regression line to these data?

    We might want to fit a regression line to these data to model the relationship between calories and carbs since Starbucks only lists the number of calroeis on the display items

  4. Do these data meet the conditions required for fitting a least squares line?

    1. Linearity - We see a linear relationship in the scatter plot
    2. Nearly normal residuals - No pattern in the residuals plot
    3. Constant variability - No pattern in the residuals plot
    4. Independent observations - assumed based on problem context

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.

    sx <- 10.37
    sy <- 9.41
    
    r <- 0.67
    
    b1 <- (sy / sx) * r
    b1
    ## [1] 0.6079749
    xhat <- 107.2
    yhat <- 171.14
    
    b0 <- yhat - b1 * xhat
    b0
    ## [1] 105.9651

    height = 105.9651 + 0.6079749x

  2. Interpret the slope and the intercept in this context.

As shoulder girth increases by 1, height increases by 0.6079749. The intercept 105.9651 describes height if shoulder girth is 0. However, the meaning of this intercept is not relevant to the context of this problem.

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

    R2 <- .67^2
    R2
    ## [1] 0.4489
  2. A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.

    105.9651 + 0.6079749 * 100
    ## [1] 166.7626
  3. The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.

    #residual = observed - predicted
    
    106 - 166.7626
    ## [1] -60.7626
    #Since the residual is negative, the predicted value is an overestimate
  4. 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?

    The original data contained shoulder girth measurements of 85 to 135 cm. Therefore, the linear model is beyond the scope for predicting the height of a child with shoulder girth 56 cm.

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 coefficients are estimated using a dataset of 144 domestic cats.

  1. Write out the linear model.

    y = -0.357 + 4.034x

  2. Interpret the intercept.

    The intercept -0/357 describes the heart weight of cats if body weight is 0. However, the meaning of this intercept is not relevant to the context of this problem.

  3. Interpret the slope.

    For every 1 kg increase in cat body weight, heart weight increases by 4.034

  4. Interpret R2.

    The model predicts 64.66% of the data

  5. Calculate the correlation coefficient.

    sqrt(64.66)
    ## [1] 8.041144

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

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

    #point 1: (0, 4.010)
    #point 2: (-0.0883, 3.9983)
    
    m <- (3.9983-4.010)/(-0.0883-0)
    m
    ## [1] 0.1325028
  2. Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.

    The slope is positive, which indicatess the relationship between teaching evaluation and beauty is positive

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

    Linearity: Nearly normal residuals: sample quantiles are close to theoretical quantiles in qq plot Constant variability: no pattern in residuals plot Independent observations: assumed based on problem context