I am looking at doctor’s visits in a specific region over a 10 year period. My response variable is the number of visits. I have three predictors/effect modifiers:

  1. Year (2007-2016)
  2. Priority: two levels (urgent visit, non-urgent visit)
  3. Type (location of the doctor’s office): five levels (large city, medium-sized city, large town, small town, rural community)

My table looks like that

enter image description here

I am trying to determine whether and to what extent Year affects the number of visits. In particular, I want to know whether the effect is different in different location types and for urgent and non-urgent visits. I am working in R using the MASS package, and ended up fitting a GLM with negative binomial distribution and an offset to account for population size.

I first ran separate models for urgent and non-urgent visits, and included year, type and an interaction term (year $\times$ type) to test whether location type modifies the effect of year:


I derived the average annual percent change for each location type, and I am able to determine whether there are significant differences in comparison to my reference level. My problem with the separate models is that I think I cannot compare coefficients between the models anymore. I can for example conclude that, in average, non-urgent visits in rural areas change by X% per year, which is significantly different from the change in non-urgent visits in large cities. But I cannot conclude that the average change in non-urgent visits in rural areas is different from the change of urgent visits in rural areas. Is that correct?

I restructured the table and tried to fit one model with a three-way interaction.

enter image description here

glm.nb(VISITS~Year+Type+Priority +YearxType + YearxPriority + TypexPriority+YearxPriorityxType + +offset(log(Pop/1000)), data=TREND)

I got similar estimates, but different significance levels and confidence intervals. I do not understand why. This model is also a bit hard to interpret.

What I want is to compare the annual change in visits per 1000 population between the combinations of type and priority. Is my last approach appropriate to do this? Is there a simpler way?

  • $\begingroup$ It sounds like a good possible application of a log-linear model. You say you use negative binomial models to account for population sizes but maybe you should be using an offset for that. You are modeling incidence after all. You can justify the three way interaction as a way of estimating a saturated model, and it enables comparisons of relative changes in urgent/non-urgent by site and across time. $\endgroup$
    – AdamO
    Commented Feb 9, 2018 at 17:31
  • $\begingroup$ I only now realized that "Year" should probably be considered a categorical and not continuous variable in my case. I ran a log-linear model under the assumption of a Poisson error structure before, but it did not fit the data well. Hence the negative binomial model. I believe it is also correct to inculde population as an offset in the negative binomial model. But maybe there are other options to fit log-linear models that fit my data better. $\endgroup$
    – Catherine
    Commented Feb 10, 2018 at 14:59

1 Answer 1


Three-way interactions can be hard to express in words so your concerns are understandable.

First of all if the three-way is significant then you should not try to interpret the two-ways still less the main effects except in the context of the three-way since it means that the two-ways differ depending on the level of the third factor. There are several things you could do to try to clarify what is going on. You could plot the proportions per year separately for Type and Priority so having four lines each with ten points. You could generate the predicted values and look at their pattern. If the interaction is very strong it would be justified to say that trying to model urgent and non-urgent together is not sensible and present the separate models you have already fitted.


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.