7.24 Nutrition at Starbucks, Part I.
- Describe the relationship between number of calories and amount of carbohydrates (in grams) that Starbucks food menu items contain.
There is an upward positive trend between the two variables. In other words, an increase in the amount of carbohydrates within the menu encourages an increase in the amount of calorie count.
- In this scenario, what are the explanatory and response variables?
- Explanatory Variable: Carbohydrates
- Response Variable: Calories
- Why might we want to fit a regression line to these data?
To predict the how much calories are in the menu based on the amount of carbs.
- Do these data meet the conditions required for ???tting a least squares line?
- Linearity: Linear relationship
- Nearly Normal residuals: The histogram appears nearly normal
- Contant Variability: Not constant especially as the both variables increase
- Independence: Each item on the menu is assumed independent
7.26 Body measurements, Part III.
- Write the equation of the regression line for predicting height.
\(\hat{y} = \beta_0 + \beta_1 * x\)
\(\beta_1 = \frac{s_y}{s_x}R\)
beta1 <- (9.41 / 10.37) * 0.67
beta1
## [1] 0.6079749
xmean <- 107.20
ymean <- 171.14
beta0 <- ymean - (beta1 * xmean)
beta0
## [1] 105.9651
Equation: \(\hat{y} = 105.965 + 0.608x\)
- Interpret the slope and the intercept in this context.
- Calculate R2 of the regression line for predicting height from shoulder girth, and interpret it in the context of the application.
R_squared <- 0.67^2
R_squared
## [1] 0.4489
- A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.
height <- 105.965 + (0.608 * 100)
height
## [1] 166.765
- The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.
residual <- 160 - height
residual
## [1] -6.765
The residual is negative so it means that the model overestimates the height.
- 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?
Based on the provided plot from Question 7.15, the range for shoulder girth on the model is between 90cm and 130. So no this model would not be appropriate because it is outside of the sample.
7.40 Rate my professor.
- 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.
beta0 <- 4.010
y <- 3.9983
x <- -0.0883
beta1 <- (y - beta0) / x
beta1
## [1] 0.1325028
- Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.
Since the slope is positive, it shows with every positive beauty score received, the teachers evaluation improve by 0.13.
- List the conditions required for linear regression and check if each one is satis???ed for this model based on the following diagnostic plots.
- Linearity: The data shows a weak linear trend.
- Nearly Normal residuals: The histogram is slightly skewed but is nearly normal. So is the normal probability (Q-Q plot).
- Contant Variability: There is constant variability since the points on the residual plot a placed randomly above and below the x axis so the model is appropriate.
- Independence: There is not any information stating how the professors were sampled so we assume independence.