`library(ggplot2)`

`## Warning: package 'ggplot2' was built under R version 3.4.4`

`library('DATA606') # Load the package`

`## Warning: package 'RCurl' was built under R version 3.4.4`

`## Warning: package 'maps' was built under R version 3.4.4`

```
##
## Welcome to CUNY DATA606 Statistics and Probability for Data Analytics
## This package is designed to support this course. The text book used
## is OpenIntro Statistics, 3rd Edition. You can read this by typing
## vignette('os3') or visit www.OpenIntro.org.
##
## The getLabs() function will return a list of the labs available.
##
## The demo(package='DATA606') will list the demos that are available.
```

`library(knitr)`

# 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.

## (a) Write the equation of the regression line for predicting height.

Answer:

x = (sdh/sdshgirth) * CR

x = (9.41/10.37) * .67

x = 0.6079749

H = x0 + 0.6079749*shoulder_girth

171.14 = x0 + 0.6079749(107.20)

x0 = 105.96509072

H = 105.96509072 + 0.6079749*shoulder_girth

## (b) Interpret the slope and the intercept in this context.

Slope: Every additional centimeter of shoulder girth the average height increases by 0.6079749 centimeters. Intercept: For a shoulder girth of 0 centimeters, the average height is 105.96509072 centimeters

## (c) Calculate R2 of the regression line for predicting height from shoulder girth, and interpret it in the context of the application.

R^2 = .67^2 = 0.4489

44.9% (0.4489) of the variability in height is explained by shoulder girth.

## (d) A randomly selected student from your class has a shoulder girth of 100 cm. Predict the height of this student using the model.

shoulder_girth = 100 cm

Height = 105.96509072 + 0.6079749*shoulder_girth

Height = 166.93999072 cm

## (e) The student from part (d) is 160 cm tall. Calculate the residual, and explain what this residual means.

Residual = 160 - 166.93999072 = -6.93999072 cm

The residual is negative, so model over estimates height based on shoulder girth.

## (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?

It would not be good to use this model to estimate the height of a one year old with a shoulder girth of 56 cm because that would require extrapolation.

# 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.

## a) Write out the linear model.

\({\beta}_0 = -0.357\), \({\beta}_1 = 4.034\), Linear model: \(\hat{y}_h = {\beta}_0 + {{\beta}_1}x = \hat{y}_h = -0.357 + 4.034x\)

## (b) Interpret the intercept.

\({\beta}_0 = -0.357\), translates to cat with body weight of `zero`

kg will have heart weight of -0.357 g. This cannot be true as weight cannot exist in negative numbers. As this observational data, caution must be observed while using model in the places it has not been analyzed.

## (c) Interpret the slope.

Every kg of increase in body weight is associated with a heart weight increase of 4.034 g.

## (d) Interpret R2.

64.66% of the variability in heart weight is explained by body weight.

## (e) Calculate the correlation coefficient.

\(R^2 = 64.66\%\), it means 64.66 percent of observed data can be explained using liner model: \(\hat{y}_h = -0.357 + 4.034x\).

# Appendix

```
library(ggplot2)
library('DATA606') # Load the package
library(knitr)
``
```