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.
It appears to be roughly linear; the more calories, the more carbs.
The explanatory variable is the calories, and the responce variable is the carbs.
So we can predict the amount of carbs one would expect for an item by it’s amount of calories.
Pretty much. This may not be so much a sample as it is the entire population (but I believe that’s ok). The residuals seem somewhat skewed; it follows that while the PROPORTION of residuals to calories may be roughly equal with increasing calories, the actual residuals will scale with the calories (more calories = more wiggle room for carbs). One can somewhat see this in the scatterplot. But would I still fit a least squares line to it? Yeah.
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}
It appears linear, and positively correlated.
The relationship wouldn’t change; the units would. Both are still units of length, so while the equation might change to factor in the conversion ratio (the above plot would shrink horizontally), the overall implications would remain 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.
xmean = 107.2
xsd = 10.37
ymean = 171.14
ysd = 9.41
corr = 0.67
slope = corr*(ysd/xsd)
slope
## [1] 0.6079749
intercept = ymean - slope*xmean
intercept
## [1] 105.9651
Height = 105.965 + 0.608 X Shoulder Girth
The intercept is 105.965, and the slope is 0.608
q = lm(hgt ~ sho.gi, data = bdims)
summary(q)$r.squared
## [1] 0.4432035
The regression line explains 44.3% of the observed variation
166.763 cm
-6.763 cm. This means that the student is 6.763 cm shorter than the model would have predicted.
No. Although it doesn’t explicitly mention it, the population likely does not include one year olds (also, there is no data from anyone with a shoulder girth around that size).
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}
Heart Weight(g) = -0.357 + 4.034 X Body Weight(kg)
For a cat with a Body Weight of 0kg, we would expect a Heart Weight of -0.357g.
For every 1kg increase in Body Weight, we would expect an increase of 4.034g in Heart Weight.
This model explains 64.66% of the variability.
sqrt(r^2) = 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}
xmean = -0.0883
ymean = 3.9983
intercept = 4.010
#intercept = ymean - slope*xmean
slope = (ymean - intercept) / xmean
print(paste("slope = ",round(slope,4)))
## [1] "slope = 0.1325"
Yes: the slope we have found is positive, and the associated p-value is almost 0.
The conditions for linear regression are met: the data is roughly linear, as evidenced by the previous scatterplot; the observations random and independent of one another; the histogram of the residuals is fairly normal; the deviation is roughly the same across all values of x in the scatterplots of the residuals.