I checked different sources here and here but was still unclear of the response so I am asking. I am thinking of using a Poisson regression for several reasons. One: response is a count, two: data not all numeric three: distribution is not normal. The problem is my data is not aggregated, it is row level and I'm no sure if it's possible to use Poisson (Note: management does not want a logistic regression). If my data must be rearranged to use Poisson, I am unsure which rearrangement to use. I am using R so here is my data frame

## patient hospital data

id <- c(123, 234, 456, 567, 678, 789, 890, 901, 1000)  # factor
year <- c(2015, 2017, 2016, 2017, 2015, 2016, 2016, 2015, 2017)  # factor
state <- c('NY', 'CA', 'NY', 'MI', 'NV', 'CA', 'CA', 'NY', 'NH')  # factor
stage <- c('adv','early','adv','stg1','stg2','adv','early','stg1','stg2') # factor
age <- c(25, 45, 67, 24, 17, 34, 75, 22, 51) # integer
wagesWk <- c(200, 1220.75, 500, 600, 500.5, 1200, 900, 200.5, 400.5) # continuous
numStateHosp <- c(45, 100, 54, 100, 37, 90, 71, 92, 52) # integer
residence <- c("condo", "shelter", "hospice", "rental", "parents", "condo", "hospice", "parents", "rental") #factor
ethnicity <- c('group1','group4','group3','group1','group1','group4','group2','group1','group4') #factor
underPhysCare <- c('N','Y','Y','N','Y','N','Y','Y', 'N')  #factor

df <- data.frame(id, year, state, stage, age, wagesWk, numStateHosp, residence, ethnicity, underPhysCare)

response: count of number patients by year and ethnicity a = year b = ethnicity

therefore: response: countPatients with subscripts ab explanatory variables: year, state, stage, age, wagesWk, ethnicity, underPhysCare

The problem is this is row level data. If I aggregate like this:


Wouldn't this require multiple Poisson regressions? If so, how do I incorporate my explanatory variables? If Poisson is not a good choice, what other choice can I use? For sure I cant OLS because the normality assumption is violated and I am not allowed to use logistic.

Note: I am not asking for code. I am asking for advice as to how to tackle this problem. Thanx in advance for your help


1 Answer 1


If I've understood correctly, you're looking to do a Poisson regression in which the data can be aggregated by year and ethinicity into a contingency table which may look like (using the data you provide)

year   group1 group2 group3 group4
  2015      3      0      0      0
  2016      0      1      1      1
  2017      1      0      0      2

If that is correct, Poisson regression is an excellent way to do this. In fact, Poisson regression is one of the main ways you can analyze contingency tables like this (the other way is logistic regression and I find it strange they won't allow you to use it). You can simply group by year and ethnicity and count the number of rows in each group. This would be the outcome and you can adjust the expected mean by year and group very simply.

Using some R code...

tabl = xtabs(~year + ethnicity, data = df)
model_data = tabl %>% 
  as.data.frame() %>% 
  mutate(year = as.numeric(year))

model = glm(Freq ~ year + ethnicity, data = model_data, family = poisson)

You can add additional predictors quite naturally by adding them to the xtabs formula.

  • $\begingroup$ Thanx for your suggestions. Isn't it a problem to make the year numeric? Shouldn't it be categorical because it is not quantitative? $\endgroup$
    – ithoughtso
    Apr 23, 2021 at 17:29
  • $\begingroup$ @ithoughtso If you're willing to make the assumption that the effect of year to year is constant, then you can leave it as such. There are good reasons to treat year as a numeric variable, and it would take very good rationale to say otherwise. $\endgroup$ Apr 24, 2021 at 0:29
  • $\begingroup$ Thanx for your input. I just realized I made a mistake. I need to look into the counts of 'underPhysCare' by year and ethnicities, can Poisson regression still be used or is this now a proportion problem? $\endgroup$
    – ithoughtso
    Apr 25, 2021 at 7:15
  • $\begingroup$ It works, thanx! $\endgroup$
    – ithoughtso
    Apr 26, 2021 at 6:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.