7.24, Nutrition at Starbucks, Part I.

a, Describe the relationship between # of calories and amount of carbs that STarbucks food menu items contain.

Answer: the relationship between number of calories and amount of carbs may be linear, but not very strong. In fact, to me it looks like the small cloud of points in the lower left corner (low calorie, low carb) is forcing the linear relationship. It is positive if it exists.

b, What are the explanatory and response variables?

Answer:Number of calories is the explanatory variable. Amount of carbs is the response variable.

c, Why might we want to fit a regression line to these data?

Answer: We may want to fit a regression line to have a way to predict the amount of carbs based on number of calories (perhaps for a new food item or for an item where amount of carbs is not readily available).

d, Do these data meet the conditions required for fitting a least squares line?

Answer: Linearity: As described in part (a), there may be a weak linear relationship. Nearly normal residuals: The histogram of the residuals is not completely symmetrical and may not necessarily be nearly normal. Constant variability: Based on the residual plot, I believe there is no contant variability as there are significantly more points on the right (with larger residuals) than on the left of the plot. Independent observations: Observations are independent since food items and their nutritional information does not depend on each other. I believe conditions are not met because of lack of constant variability and distribution of residuals that is not nearly enough normal.

7.26, Body measurements, Part III

a, Write the equation of the regression line for predicting height

responseMean = 171.14
responseSD = 9.41
Rvar = .67
explanatoryMean= 107.2
explanatorySD= 10.37
slope = (responseSD/explanatorySD)*Rvar
intercept = responseMean - (slope)*explanatoryMean
regressionFunction = function(x,slope,intercept){
  y =(x*slope)+ intercept
  return(y)
}
tinyGraph = 1:150
tinyGraph = sapply(tinyGraph,regressionFunction,slope,intercept)
plot(tinyGraph, type = 'l',xlab = 'Shoulder girth',ylab='height')

b, Interpret the slope and intercept in this context

Answer: The intercept has a positive offset, slope is going up there at a .6 rate to shoulder girth.

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

Answer: R2=0.672=0.4489. 44.89% of the variation 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.

Answer: If x=100, then height is predicted to be y^=105.9651+0.6079749???100=166.7626 cm.

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

Answer: Residual = observed - predicted, which for this case is -6.7625805 Meaning the actual height is that much less than the line predicted.

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: Original data only includes 80 to 140 shoulder girth which is a minus.Variability seems to be constant, correlation is strong and linear.While it would be innappropriate, I’d do it in absence of any other model.

7.30, Cats, Part I

a, Write out the linear model.

Answer: y= -.357 + 4.034 * x

b, Interpret the intercept

Answer: The intercept will be at -0.357, which tell us that this modelt will predict a negative weight for the cat’s heart when the body weight is at zero..

c, Interpret the slope

Answer: the slope is 4.034 which means that the weight of the cat’s heart will increase 4.034 grams for every 1 kg of cat body weight increase

d, Interpret R2

Answer: R^2 is 64.66% which tells us that the linear model estimates a 64.66% in variation in cat heart weight

7.40 Rate my professor.

a,

b0 <- 4.010

x <- -0.0883
y <- 3.9983

b1 <- (y - b0) / x
b1
## [1] 0.1325028

Answer:The slope b1=3.9983???4.01???0.0883=0.1325028.

b,

Answer: Since the slope is positive the relationship is positive. If we set up a hypothesis test with H0:??1=0 and HA:??1>0, then based on the summary table the p???value is nearly 0. And this is for a two-sided test, so it’ll be even closer to 0 for a one-sided test. We reject the null hypothesis. There is convincing evidence that the relationship between teaching evluation and beauty is positive.

c,

Answer: Linearity: Based on the scatterplot, there may be a weak linear relationship. There is no evident pattern in the residual plot. Nearly normal residuals: The histogram of the residuals exhibits a left skew. Additionally, the points seem to move away from the normal probability line on each end. However, the bulk of the data is very close to the line. I would conclude that the distribution of residuals is nearly normal. Constant variability: Based on residual plot, there appears to be constant variability in the data. Independent observations: Observations are not a time series, and can be assumed to be independent (unless there is evidence that students copied each other’s evaluations). I believe all conditions are satisfied for this linear model.

  1. Cacluclate hte correlation coefficient We take the square root of R2 which is 0.8041144