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 con-tain.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.
(a) Describe the relationship between number of calories and amount of carbohydrates (in grams) Starbucks food menu items contain.
The releationshio shows a weak positive relationship
(b) In this scenario, what are the explanatory and response variables?
Calories is the explanatory, carbs is the response
(c) Why might we want to fit a regression line to these data?
So we can determine the number of carbs by looking at the number of calories
(d) Do these data meet the conditions required for fitting a least squares line?
The data seems to meet the conditions for fitting a least squares line, however, as calories increase there is some amount of variability.
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.
(a) Write the equation of the regression line for predicting height.
sy <- 9.41
sx <- 10.37
xbar <- 107.2
ybar <- 171.14
R <- 0.67
b1 <- sy/sx * R
b0 <- b1 * -xbar + ybar
b1
## [1] 0.6079749
b0
## [1] 105.9651
(b) Interpret the slope and the intercept in this context.
??1: For each cm of shoulder girth, the model predicts an additional .61 cm in height. ??0: When shoulder girth is 0 cm, the height is expected to be 105.97. Since it’s not possible to have a shoulder girth of 0, the y-intercept is meaningless and only servces to adjust the height of the line.
(c) Calculate R2 of the regression line for predicting height from shoulder girth, and interpret it in the context of the application.
R^2
## [1] 0.4489
About 45% of the variability in height is account for by shoulder girth
(d) A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.
xstudent <- 100
height <- function(x, b1, b0) x * b1 + b0
yhat <- height(xstudent, b1, b0)
yhat
## [1] 166.7626
(e) The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means
160 - yhat
## [1] -6.762581
Negative means that the model overestimates the height
(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 - value is outside the observered values.
7.30 Cats, Part I. The following regression output is for predicting the heart weight (in g) of catsfrom their body weight (in kg). The coecients are estimated using a dataset of 144 domestic cats.
(a) Write out the linear model.
\(\hat{weight_{heart}} = 4.034 * weight_{body} - 0.357\)
(b) Interpret the intercept.
The expected heart weight for cats with 0 body weight is 0.357. Since these are not meaningful values, the y-intercept serves to adjust the height of the regression line
(c) Interpret the slope.
Since b1 is positive, we should expect a positive relationship.
(d) Interpret R2.
About 65% of the variability in weight is accounted for by body weight
(e) Calculate the correlation coefficient
R2 <- 0.6466
sqrt(R2)
## [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 evalu-ations 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 ap-pearance 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 evaluationscore is 3.9983, calculate the slope. Alternatively, the slope may be computed using just theinformation provided in the model summary table.
b0 <- 4.01
xbar <- -0.0883
ybar <- 3.9983
b1 <- (ybar - b0/xbar)
b1
## [1] 49.41166
(b) Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.
Yes. The slope is positive and the p-value is near 0.
(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: It’s not certain that we are seeing a linear trend.
Nearly normal residuals: The histogram of the residuals is left-skewed. Residual values don’t follow the qq line.
Constant variability: As the beauty score increases, the residual variability appears to decrease.