7.24 Nutrition at Starbucks, Part I.

a.Describe the relationship between number of calories and amount of carbohydrates (in grams) that Starbucks food menu items contain.

The number of alories and amount of carbohydrates is positive linear relationship.

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

The explanatory variable is the number calories and the response variable is the amount of carbohydrates.

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

We can predict the amount of carbohydrates in Starbucks food items based on the number of calories.

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

Yes, because the data fit linearity, nearly normal residual, constant variability and the observations are independent.

7.26 Body measurements, Part III.

a.Write the equation of the regression line for predicting height.

b1 <- (9.41 / 10.37) * 0.67
b0 <- (b1 * (0-107.2))+ 171.14
b1
## [1] 0.6079749
b0
## [1] 105.9651

\[\hat{y}= 105.9650878 + 0.6079749x\]

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

The intercept is the height in centimeters at girth of 0 cm.
The slope is the increase in number of centimeters in height for increase in shoulder girth.

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

r2 <- 0.67^2
r2
## [1] 0.4489

\(R^2 =0.4489\).

45% of the variance of the height depends on the variance of the shoulder.

d.A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.

height_shoulder <- function(girth)
{
  height <- b0 + b1 * girth
  return(height)
}
predict <- height_shoulder(100)
predict
## [1] 166.7626

e.The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.

height = 160
e <- height - 166.7626
e
## [1] -6.7626
Residual is -6.7626.

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

No, it is not appropriate because it is almost 5 standard deviation below the mean of the shoulder girth.

7.30 Cats, Part I.

a.Write out the linear model.

\[\hat{y} = -0.357 + 4.034x\]

b.Interpret the intercept.

When the cat's height is 0, then the heart weight will be negative.

c.Interpret the slope.

The slope is 4.034. when the cat's body weight increases by 1 gram, the heart weight will increase by 4.034 grams.

d.Interpret R2.

The R2 is 64.66%. 64.66% of the variation the heart weight depends on the variabtion of the cat's body.

e.Calculate the correlation coefficient.

R2 = 0.6466
r <- sqrt(0.6466)
r
## [1] 0.8041144

7.40 Rate my professor.

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.

b1 <- (3.9983 - 4.010)/-0.0883 
b1
## [1] 0.1325028

b.Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.

It provides convincing evidence between teaching evaluation and beauty is positive because the P-value is approximate to 0, we can reject the null hypothesis.

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

Linearity: The residual plot is scattered around 0 indicates a linear relationship.

Normal residual: In the QQ plot, they are approximately normal. They are nearly normal.

Constant Variability: The scatterplot of the residuals appears to have constant variability.

Independent Observations: The professors were selected at random, so they are independent.