Fit a linear regression model with totalwgt_lb as the response variable and babysex as a categorical explanatory variable -- the value of this variable is 1 for boys and 2 for girls. What is the estimated difference in weight? Is it statistically significant? What if you control for the mother’s age -- does maternal age account for some or all of the apparent difference?
The Trivers-Willard hypothesis suggests that for many mammals the sex ratio depends on "maternal condition" -- that is, factors like the mother’s age, size, health, and social status. Some studies have shown this effect among humans, but results are mixed.
Let’s see if there is a relationship between mother’s age and the probability of having a boy. Fit a logistic regression model with the baby’s sex as the response variable and mother’s age as an explanatory variable. Are older mothers more or less likely to have boys? What if you use a quadratic model of maternal age?
For the Adelie penguins, fit a linear regression model that predicts penguin weights as a function of flipper_length, culmen_depth, and Sex as a categorical variable. If we control for flipper length and culmen depth, how much heavier are male penguins? Generate and plot predictions for a range of flipper lengths, for male and female penguins, with culmen_depth set to its average value.
Let’s see if Chinstrap penguins are more or less dimorphic than the other penguin species in the dataset, as quantified by the pseudo \(R^2\) value of the model. Use get_species to select the Chinstrap penguins, then use logistic regression to fit a logistic regression model with sex as the response variable and all four measurements as explanatory variables. How does the pseudo \(R^2\) value compare to the other models?