Nutrition at Starbucks, Part I. (8.22, p. 326) 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.
The relationship between calories and carbs seems to be positive overall but there is some variability especially at the higher calories level where the data points exist on both sides of the regression line.
The explanatory variables are calories along the x-axis and carbs are the response variable on the y-axis.
A regression line helps us understand the relationship between the two variables and gives an estimate of the amount of carbs based on the number of calories.
No, these data do not satisfy for fitting a least square line. The histogram of residual appears normal.Independent observations. Linearity: The scatter plot shows a linear relationship between carbs and carolies, and Constant Variability: There seem to be constant variability among the variables.
Body measurements, Part I. (8.13, p. 316) Researchers studying anthropometry collected body girth measurements and skeletal diameter measurements, as well as age, weight, height and gender for 507 physically active individuals. The scatterplot below shows the relationship between height and shoulder girth (over deltoid muscles), both measured in centimeters.
\begin{center} \end{center}
There is a positive relationship between the height and shoulder girth as evidenced in the graph above.
The positive relationship would be the same but the slope would steepen to account for the larger change in height for each inch of shoulder.
Body measurements, Part III. (8.24, p. 326) Exercise above 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.
mean.shoulder <- 107.20
sd.shoulder <- 10.37
mean.height <- 171.14
sd.height <- 9.41
R <- 0.67
b1 <- R * (sd.height / sd.shoulder)
b1
## [1] 0.6079749
b0 <- mean.height - b1 * mean.shoulder
b0
## [1] 105.9651
The slope is 0.6079749 – So, for every 10 cm increase in soulder girth, there will be an aditional 6.08cm to the height. But not all values makes sense as we plug them into linear regression equation. for ex: with a shoulder width 0cm (hypothetically) still indicates a height of 105.965 which doesn’t makes sense.
R^2
## [1] 0.4489
r^2 is 0.4489. It means the regression line accounts for 44.89% of the variance height predicted from shoulder girth.
random.student.s <- 100
student.height <- b0 + (b1 * random.student.s)
student.height
## [1] 166.7626
160-student.height
## [1] -6.762581
The residual means- negative
No value is outside the observered values.
Cats, Part I. (8.26, p. 327) 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.
\begin{center} \end{center}
y^=−0.357+4.034∗body.weight
Expected heart rate of a cat with 0 kg of body weight is -0.357, Since these are not meaningful values, the y-intercept serves to adjust the height of the regression line.
For each additional kg increase in body weight, we expect an additional 4.034 grams in the heart weight of a cat.
About 65% of the variability in weight is accounted for by body weight
R2 <- 0.6466
sqrt(R2)
## [1] 0.8041144
Rate my professor. (8.44, p. 340) 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.
\begin{center} \end{center}
b1 <- (3.9983 - 4.010) / (-0.0883)
b1
## [1] 0.1325028
Yes. The slope is positive and the p-value is near 0
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.