1. Run the model on slide 10 of Lecture “Polynomial Predictors”. Make sure to save the re-gression object. Then estimate emmeans as per slide 11 for: a. age, but leave out the “at =” list. b. age, but specify the mean value of age in the regression sample. You can get the mean as mean(model.matrix(modInc2L `age’]). First store this value in some variable, say “a”, and use this variable as “at = list(age = a)”. c. by female without specifying age. d. by female specifying age as mean in regression sample.
2. Run the fractional polynomial model from slide 46, but add female to the regression, “fp(age) + female”.
a. Generate emmeans by age from 20 to 80 in increments of 10 years b. Generate emmeans by female. c. Generate emmeans by female and by age from 20 to 80 in increments of 10 years. d. Generate a emmeans plot like in slide 48, but include a breakdown by female as well. To add female to the graph, add a term to the aes() statement so the aes() statement becomes “aes(x = age, y = emmean, colour = female)”. Otherwise the plot command looks the same.