Graded: 7.24, 7.26, 7.30, 7.40
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.
Figure 7.24
There is positive linear relationship between calorie and carbohydrates.
x - axis is Calorie which is explanatory variable
y-axis is Carbohydrate which is response variable.
We would like to predict the amount of carbs based on calorie count.
The data fit a linear plot, residuals appear nearly normal. we cannot achieve constant variability.
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.
Figure 7.26
B1=round(0.67 * (9.41/10.35),4)
B0=round(B1 * -107.20 + 171.14 , 4)
\[ \hat{y} = 105.8445 + 0.6091 * `shouldergirth` \]
For additional cm of shoulder girth, there would be additional .6091 of height.We would expect a height of .6091 , If the shoulder girth of person is Zero.
R=0.67
R2=R*R
Value of R\(^2\) = 0.4489
R100=B0 + B1 * 100
R100
## [1] 166.7545
# Residual = Observed - Expected
Res=160 - 166.7545
Res
## [1] -6.7545
Model Overestimated the height of the individual.
This can be achieved only through Extrapolation. We are making an assumption that we can achieve linear relationship in uncharted data
The following regression output is for predicting the heart weight (in g) of cats from their body weight (in kg). The coe cients are estimated using a dataset of 144 domestic cats.
Figure 7.30_1
Figure 7.30_2
B0=-0.357
B1=4.034
\[ \hat{y} = -0.357 + 4.034 * `bodyweight` \]
If cat’s body weight is zero
, we will expect the heart to weight -0.357 grams
For each additional kg of body weight, we can expect cat’s heaert to weigh additional 4.034 grams
R\(^2\) = 64.66%, which means 64.66% of observed data can be explained using the linear model in (a)
R2=.6466
corcof = sqrt(R2)
corcof
## [1] 0.8041144
Many college courses conclude by giving students the opportunity to evaluate the course and the instructor anonymously. However, the use of these student evalu- ations 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 ap- pearance 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.
Figure 7.40_1
B0=4.010
B1=4.13 * 0.0322
The value of slope is 0.132986
On looking at scatter plot we can just see Scaters. There is no any upward or downward trend. p is shown as zero in summary table. It can be read as accepting the null hypothesis; there is no relation between teaching evaluation and beauty.
Figure 7.40_2
Visual inspection of scatterplot suggest residuals are randomly scattered around horizontal axis. Linearity is achieved
Histogram is left skewed, so there could be some outliers. Residuals are nearly normal.
From scatterplot, the points has constant variance
These are independant observations, and shows a minor linear trend