For my third learning log, I took a look at the dataset comparing women’s heights and weights.
Next, I plotted the data, comparing womens heights and weights. I chose to use their heights as a predictor for their weights.
plot(height, weight)
This shows that there is a trend, and a positive one at that.The trend looks like it may not be linear, but it seems very close from this perspective.
The next step I took was in making a regression line and plotting it ontop of the graph above.
myWmod <- lm(weight ~ height)
myWmod #used to find y intercept and slope
##
## Call:
## lm(formula = weight ~ height)
##
## Coefficients:
## (Intercept) height
## -87.52 3.45
plot(height, weight)
abline(myWmod)
This graph shows us more clearly that womens heights and weights dont have a perfectly liniar relationship. To help show this even clearer, here is a plot of the residuals against women’s height.
myWresids <- myWmod$residuals
plot(myWmod$residuals ~ height)
abline(0,0)
This clearly shows that there is a parabolic nature when comparing womens height and their weight