(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.
(a) Describe the relationship between number of calories and amount of carbohydrates (in grams) that Starbucks food menu items contain.
Answer:
There is a positive linear relationship between columns cabs
and calories
.
(b) In this scenario, what are the explanatory and response variables?
Answer:
Explanatory variable: calories
;
Response variable: cabs
.
(c) Why might we want to fit a regression line to these data?
Answer:
by fitting a regression line to these data, we can predict the amount of carbs a menu item has based on its calorie content.
(d) Do these data meet the conditions required for fitting a least squares line?
Answer:
No. Base on the second residual plot (the second graph), the absolute value of residual increase as value of calories
increase, which violates the constant variability condition.
(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.19 The scatterplot below shows the relationship between height and shoulder girth (over deltoid muscles), both measured in centimeters.
\begin{center} \end{center}
(a) Describe the relationship between shoulder girth and height.
Answer:
There is a positive linear relationship between sho.gi
and hgt
.
(b) How would the relationship change if shoulder girth was measured in inches while the units of height remained in centimeters?
Answer:
The relationship between inches and centimeters is: inch * 2.54 = cm. Therefore there is also an positive linear relationship between inches and centimeters.
Converting inches to centimeters will not change the relationship between sho.gi
and hgt
. There is still a positive relationship.
(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.
(a) Write the equation of the regression line for predicting height.
Answer:
The regression line is y = 0.6079749 * x + 105.9651 where x stands for sho.gi
and y for hgt
m_x <- 107.20
sd_x <- 10.37
m_y <- 171.14
sd_y <- 9.41
r <- 0.67
b1 <- r* sd_y/sd_x
b0 <- m_y - m_x*b1
b1
## [1] 0.6079749
## [1] 105.9651
(b) Interpret the slope and the intercept in this context.
Answer:
The slope is 0.6079749, which means for one 1cm increase / decrease on shoulder girth, the height is estimated to increase / decrease by 0.6079749cm.
The intercept means within the scope of current data, the value of height is at least 105.9651cm larger the value of shoulder girth in addtion to the gain from the slope.
(c) Calculate \(R^2\) of the regression line for predicting height from shoulder girth, and interpret it in the context of the application.
Answer:
The \(R^2\) is 0.4489, which means around 44.89% of the variation in height can be explained by height.
## [1] 0.4489
(d) A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.
Answer:
The height of this student is predicted to be 166.76cm
## [1] 166.7626
(e) The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.
Answer: The residual is -6.76cm, which means we overestimated the student’s height by 6.76cm.
## [1] -6.762581
(f) 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?
Answer:
No, the observed value is too far away from the scope of current data. The linear model is not effective on predict the height on such observed values.
(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}
(a) Write out the linear model.
Hwt
and x for Bwt
##
## Call:
## lm(formula = cats$Hwt ~ cats$Bwt)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.5694 -0.9634 -0.0921 1.0426 5.1238
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.3567 0.6923 -0.515 0.607
## cats$Bwt 4.0341 0.2503 16.119 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.452 on 142 degrees of freedom
## Multiple R-squared: 0.6466, Adjusted R-squared: 0.6441
## F-statistic: 259.8 on 1 and 142 DF, p-value: < 2.2e-16
(b) Interpret the intercept.
Answer:
The intercept means within the scope of data, the heart weight of a cat is at least 0.3567g less than body weight in addtion to the gain by the slope.
(c) Interpret the slope.
Answer:
the slope means for 1kg increase / decrease of body weight, the heart weight increase / decrease by 4.0341g.
(d) Interpret \(R^2\).
Answer:
The \(R^2\) means around 64.66% of the variation of heart weight can be explained by body weight.
(e) Calculate the correlation coefficient.
Answer:
The correlation coefficient is 0.8041274.
## [1] 0.8041274
(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}
(a) 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.
Answer:
The slope is 0.133.
##
## Call:
## lm(formula = eval ~ beauty)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.80015 -0.36304 0.07254 0.40207 1.10373
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.01002 0.02551 157.205 < 2e-16 ***
## beauty 0.13300 0.03218 4.133 4.25e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5455 on 461 degrees of freedom
## Multiple R-squared: 0.03574, Adjusted R-squared: 0.03364
## F-statistic: 17.08 on 1 and 461 DF, p-value: 4.247e-05
(b) Do these data provide convincing evidence that the slope of the relationship between teaching evaluation and beauty is positive? Explain your reasoning.
Answer:
The the summary above shows that the p-value of the slope is very small and so it is significant that there is a positive relationship between eval
and beauty
.
(c) List the conditions required for linear regression and check if each one is satisfied for this model based on the following diagnostic plots.
Answer:
The residuals in the scatter plot distributed randomly around y=0. No obvious shapes or patterns is found, which shows strong linearity between beauty score and teaching evaluation score.
2: Nearly normal residuals
The histogram shows a unimodal and symmetric distribution. Also, the normal probability plot lies along to the normal quantiles line. Therefore, the residuals are appear to be normally distributed.
3: Constant variability
Most of the residuals are within the arrange of -1 and 1. Therefore the constant variability condition appears to be met.
The plot ‘Order of data collection’ shows that the residuals are randomly distributed and are independent of the time of data collection. Therefore, the independence of errors appears to be met.