My question is similar to this one GLM with grouped/aggregated data in R, but I have a specific question regarding my data set. I have included below an aggregated data set of frequency of death by gender and age group from 2005 to 2015.

 structure(list(age_9 = structure(c(1L, 1L, 2L, 2L, 3L, 3L,
 4L,4L, 5L, 5L, 6L, 6L, 7L, 7L, 8L, 8L, 9L, 9L),
.Label = c("0 - 14 years", "15 - 24 years","25 - 34 years", "35 - 44 
years","45 - 54 years", 55 - 64 years", "65 - 74 years
"75 - 84 years", "85+"),class = "factor"),  = structure(c(1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L),
.Label = c("Male", "Female" ), class    = "factor"),
count = c(6, 4, 7, 5, 15, 15, 18, 35, 39, 62, 71, 79, 71,89, 83, 120, 
66, 123),
pop = c(336085, 316508, 266001, 256539, 220505, 233310, 
219358, 239771, 220639, 197750, 236558, 155796, 188762,
77920, 104571, 26234, 44487)),
.Names = c("age_9", "sex", "count", "pop"), 
row.names = c(NA, -18L), vars = "age_9",
drop = TRUE,class = c("grouped_df", "tbl_df","tbl", "data.frame"))

Let's say I want to use this data to test if females had higher risk of dying than males accounting for age groups.

Based on the document (pdf) linked in the referenced original question I think I should use a generalized linear model on my aggregated data for my specific question, but I'm not sure:

glm(count ~ sex + age, family=poisson(link=log), offset=log(?), data=A2)

My questions are:

  1. Is adequate to formulate the above GLM with the included aggregated data set?
  2. if no, why?
  3. If yes to question 1, What would be an appropriate offset vector?
  • $\begingroup$ Your data appear to supply no information about risk of death. To assess that, you would also need to know how many males and females were in each group originally--that is, the numbers at risk of dying. What are these data actually counting? $\endgroup$
    – whuber
    Jul 3, 2017 at 19:04
  • $\begingroup$ @whuber, thanks for your response. The data is counting the number of death within each groups from 2005 to 2015. Based on your response, I edited the data set to included a population vector. With this new information is adequate to conduct the following glm? glm(count ~ sex + age_9, family = "poisson", offset = log(pop), data = A1) $\endgroup$
    – José
    Jul 3, 2017 at 19:41
  • $\begingroup$ It appears adequate. The exercise seems like it underutilizes the data, though. Obviously there are huge differences in rates between males and females from one age group to another. A model that posits one underlying rate for each gender would not be able to account for this important phenomenon. If your purpose is to study these data (and not just to test the software), consider a deeper exploration that includes (a) visualizing the data and (b) accommodating this age-gender interaction. $\endgroup$
    – whuber
    Jul 3, 2017 at 19:47
  • $\begingroup$ whuber, Thank you. Your response is very useful to me. One of the major limitations that I am confronting is that I have other variables within the mortality data, that I can aggregate by, but do not find the respective population estimates. That was the main reason I wanted to explore if it was possible to use another offset vector to perform the glm. $\endgroup$
    – José
    Jul 3, 2017 at 20:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.