Hazal Gunduz
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 the number of calories and the amount of carbohydrates (in grams) that Starbucks food menu items contain is linear as evidenced by graph above.
=> Calories are the explanatory variable and carbs the response variable.
=> We could fit a regression line to these data to see if we could find a relationship between the two variables.
=> The data is somewhat tricky, it seems to meet the conditions for fitting at least squares line (linearity), near to normal residuals, constant variability and independent observations), but there is some variability as calories increase.
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.
=> The relationship between shoulder girth and height is positive linear as height increases with shoulder girth. However, the relationship is not too strong.
=> In this case, the shoulder girth dimension will be shifted to the right, which will shift all the points to the right, but the linearity will still be there, and therefore the relationship will be the same.
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.
shoulder.mean <- 107.20
shoulder.SD <- 10.37
height.mean <- 171.14
height.SD <- 9.41
R <- 0.67
B1 <- R * (height.SD/shoulder.SD)
B0 <- 171.14 - B1 * 107.20
B1;B0
## [1] 0.6079749
## [1] 105.9651
=> Slope; represents the number of centimeters increase in height for each increase in shoulder girth. Intercept, represent the height in centimeters at girth of 0 cm.
R^2
## [1] 0.4489
=> 45% of the variability in height is account for by shoulder girth.
x <- 100
y <- B0 + B1 * x
y
## [1] 166.7626
=> The height predicted for this student is 166.76 cm.
i = 100
yi <- 160
ei <- yi - y
ei
## [1] -6.762581
=> The residual for this observation is: -6.762581.
=> It would not be appropriate to predict the height of this child, because 56 cm is outside of the range of the shoulder girth which is between 85 cm and 135 cm.
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.
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.357 0.692 -0.515 0.607 body wt 4.034 0.250 16.119 0.000 s = 1.452 R2 = 64.66% R2adj = 64.41%
=> y = −0.357 + 4.034 * x
=> The intercept will be at -0.357. This value tells us that this model will predict a negative heart weight when the cat’s body weight is 0.
=> For each additional kg increase in body weight, we expect an additional 4.034 grams in the heart weight.
=> the R2 = 64.66% shows us that the linear model describes 64.66%
R2 <- 0.6466
R <- sqrt(R2)
R
## [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.
slope <- (4.010 - 3.9983) / 0.0883
slope
## [1] 0.1325028
=> b1 > 0 => b1 = (Sy/Sx).R > 0. Since Sy > 0 and Sx > 0
=> Since both Sy and Sx are positive the data slope is positive as well.
=> Constant variability: The residual scatterplot indicates constant variability.
=> Independent observations: We assume data is independent in the sample.
=> Nearly normal residuals: The residuals is not normal and is skewed.
=> Linearity: It’s not certain that we are seeing a linear trend.
=> Independent observations: Assuming independence due to no clear evidence one way or the other. 463 professors is in fact < 10% of nationwide professors.
Rpubs => https://rpubs.com/gunduzhazal/829315