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.
Problem 7.24
There appears to be a linear relationship between carbohydrates and calories. As the number of calories increase so does the number of carbs. However, the relationship is not strong.
The explanatory variable is calories and the response variable is carbohydrates.
We want to fit a regression line to make predictions about the number of carbs based on the number of calories.
Conditions required for fitting a least squares line: 1. Linearity - Condition satisfied. The scatter plot between the two variables show linearity. 2. Nearly normal residuals - Condition satisfied. The histogram shows a normal, unimodal, symmetrical distribution. 3. Constant variability - Condition IS NOT satisfied. The variability of the points is higher above the line. 4. Independent observations - Condition is met. Assuming that calories and carbs are independent.
Summary, not all conditions are met.
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.
y= 171.14
std_y = 9.41
x = 107.20
std_x = 10.37
r = 0.67
slope = r*(std_y/std_x)
slope## [1] 0.6079749
bo = y - (slope*x)
bo## [1] 105.9651
y = 105.9651 + 0.6079749x
In this context, the slope represents the increase in height given an increase in shoulder girth. Height increases 0.6079749 cm per shoulder girth. The intercept represents when the x value is zero or no change in girth.
The R2 of a linear model describes the amount of variation in the response that is explained by the least squares line. In this context, the r2 is 0.4489
r^2## [1] 0.4489
Given, the shoulder girth of 100 cm. The student’s height is 166.76 cm
height = 105.9651 + (0.6079749*100)
height## [1] 166.7626
The residual is -6.76259 which means that the regression line overestimated the height by -6.76259
Residual = 160 - height
Residual## [1] -6.76259
No. A one year old in the sample which consisted of 507 physically active individuals which we can assume to be adults.
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.
heart_weight = -0.357 + 4.034x
The intercept is when the cat’s body weight is zero which is counter-intuitive since a cat’s weight can never be zero.
The slope measures the increase in heart_weight given an increase in body weight of the cat. In this case, the heart weight increases 4.034 kilograms per body weight of a cat.
The coefficient of determination, R2, which is .6466 describes the proportion of the variation explained by the least squares regression line. 64.66% of the variation is explained by this linear relationship.
The r is 0.8041144
r = sqrt(.6466)
r## [1] 0.8041144
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.24 The scatterplot below shows the relationship between these variables, and also provided is a regression output for predicting teaching evaluation score from beauty score.
Problem 7.40
The slope is 0.1325028
x1 = -0.0883
y1 = 3.9983
intercept = 4.010
slope = (y1-intercept) / x1
slope## [1] 0.1325028
The P value is < .05 which means that we can reject the null hypothesis.There is a relationship between teaching evaluation and beauty.
Problem 7.40_01
Conditions required for fitting a least squares line:
Linearity - Condition satisfied. The scatter plot between the two variables show linearity.
Nearly normal residuals - Condition satisfied. The histogram shows a normal, unimodal, symmetrical distribution.
Constant variability - Condition satisfied. Spread around the residual line shows constant variability.
Independent observations - Condition is met. Professors were chosen randomly.
Summary, not all conditions are met.