library(Zelig)
library(stargazer)
library(car)
data(Davis)
In this report, I will perform an analysis on the relationship between height and weight. To do so, I will use the Davis data set which consists of five variables (columns): sex, weight, height, reported weight, and reported height. In this report I will focus on sex, weight, and height.
plot(height ~ weight, data = Davis)
abline(lm(height ~ weight, data = Davis))
Looking at the graph of height versus weight, there is an obvious trend that weight increases with height. To further examine this trend, I will perform an ordinary lease squares regression on height and weight. In a second regression I included sex as a second independent variable to control for gender in our analysis.
reg1 <- zelig(weight ~ height, data = Davis, model = "normal")
reg2 <- zelig(weight ~ height + sex, data = Davis, model = "normal")
stargazer(reg1, reg2, type="text")
##
## ==============================================
## Dependent variable:
## ----------------------------
## weight
## (1) (2)
## ----------------------------------------------
## height 0.238*** -0.313***
## (0.088) (0.086)
##
## sexM 22.498***
## (2.087)
##
## Constant 25.266* 109.114***
## (14.950) (14.205)
##
## ----------------------------------------------
## Observations 200 200
## Log Likelihood -823.496 -777.126
## Akaike Inf. Crit. 1,650.993 1,560.252
## ==============================================
## Note: *p<0.1; **p<0.05; ***p<0.01
In my first regression, I treated weight as the dependent variable and height as the independent variable. As seen in the table above height is a statistically significant at the 99% significance level, and for every centimeter increase in height we expect a 0.238 increase in weight.
In the second regression I controlled for gender by adding the variable sex as a second dependent variable. In this regression both height and sex are statistically significant. The model predicts males to weigh 22.498 kilograms more then their female counterparts of the same height. The most interesting result of this second regression is that increases in height has an inverse relationship with weight. That is for every centimeter increase in height we expect a 0.313 kilogram decrease in weight.
In our simple analysis, we see a positive correlation between height and weight. However our second regression indicates the picture is not quite that simple. When we control for gender, the correlation between height and weight turns negative within our sample. While these results are interesting, they are most likely the result of skewness within the Davis sample rather than representative of a broader trend of people.