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 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.
knitr::include_graphics("https://raw.githubusercontent.com/maharjansudhan/DATA606/master/7.JPG")
Answer: According to the graph, as the calories increase, there is an increase in carbs also.
Answer: Here, Calories is the explanatory variable and Carbohydrates is the response variables.
Answer: So, that people can know if they are consuming very low carbs and have to change diet to intake more carbs or consume less carbs if they are intaking more.
Answer: No, it doesn’t meet the condition because as the calories increase the carbs increase.
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.
Answer:
# to calculate slope
m <- 0.67 * (9.41/10.37)
m
## [1] 0.6079749
# to calculate intercept
b <- 171.14 - m * 107.2
b
## [1] 105.9651
Here, m = 0.6079 and b = 105.96 Therefore, the equation is \[ \hat{y} = 105.97 + 0.61 * x \]
Answer: Here, when shoulder girth is at 0 we can get heigt 105.97 cm. Each additional cm in shoulder girth the equation predicts an additional 0.61 cm in height.
Answer:
R2 <- 0.67 ^2
R2
## [1] 0.4489
Therefore, R^2 = 0.4489 which means there is around 45% of variability in height.
Answer:
height <- b + m * 100
height
## [1] 166.7626
According to the calculation, the height can be predicted as 166.76 cm
Answer:
residual <- 160 - height
residual
## [1] -6.762581
The residual is -6.76. Hence, a negative residual means the student’s height is -6.76 cm less than the expected height.
Answer: According to the graph on question 7.15, the model is based on the dataset which has the lowest shoulder girth of around 80s cms. So, there is no possibility that we can predict the accurate height of a child who has 56 cm of shoulder girth.
7.30 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. 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 R^2 = 64.66% R^2adj = 64.41%
Answer: \[ \hat{heart weight} = -0.357 + 4.034 * body weight \]
Answer: According to the equation, if the body weight is 0, the heart weight is -0.357 g which is not possible. So, in order to have some heart weight a cat should have some weight.
Answer: The slope value of 4.034 indicates that for each additional kg of body weight there will be additional 4.034 gm of heart weight.
Answer: R^2 = 64.66% means, 64.66% of the variability in heart weight is explained by body weight.
Answer:
corr_coeff <- sqrt(64.66/100)
corr_coeff
## [1] 0.8041144
The correlation coefficient is 0.8041
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 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.
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.010 0.0255 157.21 0.0000 beauty 0.0322 4.13 0.0000
Answer:
# calculate slope
slope <- (4.010-3.9983)/(0-(-0.0883))
slope
## [1] 0.1325028
Slope is 0.1325
Answer: According to the given information, yes it can be approved that slope of the relationship between teaching evaluation and beauty is positive. Since, we have positive slope which means there is a positive correlation and the p-value is very small that states that the null hypothesis might be close to zero.
knitr::include_graphics("https://raw.githubusercontent.com/maharjansudhan/DATA606/master/7.40.JPG")
Answer:
Linearity :- According to the graph, the data appear to be linear. There is no curve.
Constant variance :- According to the graph, the points seem evenly spread. There are no pattern which means there is a constant variance.
Normally Distributed Residuals :- According to the graph, it has a slight left skew but looks fairly Normal in the QQ plot and Histogram.