2

I'm trying to fit a GLMER poisson model with level 1 and level 2 predictors. There's plenty of information in this website about fitting a Poisson GLM with level 1 predictors. My question is whether one can simply add level 2 predictors to this type of model, such as characteristics about the site (e.g., school or hospital characteristics). For example, here is a very good description of fitting a model with level 1 predictors in the typical example of "pupils within classes." But how would you add level 2 predictors to this type of model, such as characteristics about the classes? In my setting, I'm trying to fit a model in which I have board members nested in companies nested in industries across three years. It looks something like this:

    fit_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 + 
        (1|Industry/Company) + (1|Year),
                    data = mydata, 
                    family = poisson(link = "log"))

Where X1, X2, and X3 are level 1 predictors (i.e., board members' characteristics) and Z1 and Z2 characteristics about the companies. Is this overall way of specifying the model correct?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Charlie Glez
  • 523
  • 2
  • 10
  • 16
  • Two questions: 1. why are you modeling year as a random effect? 2. SIC is the industry variable? Just asking because as long as you specify the random effects correctly, you indeed put the fixed effects, at any level, in as you have done – Rick Hass Feb 05 '21 at 20:05
  • @RickHass Hi Rick, I'm modeling year as a random effect to rule out the possibility of tendencies in the data, would doing it as a random effect be incorrect? I'm following a set of 120 companies nested in industries for 3 consecutive years. Yes, sorry, SIC=Industry, I've edited the question to correct this. – Charlie Glez Feb 05 '21 at 20:13
  • you could do either, see my answer below. Good luck! – Rick Hass Feb 05 '21 at 20:19

2 Answers2

4

Late to this party but didn't want to miss out on all the fun!

The terminology of level-1 and level-2 predictors is usually reserved for a situation where you have two random grouping factors (e.g., Industry, Company) and one of those factors is nested in each other (e.g., Company is nested in Industry, in the sense that each Industry represented in your data includes companies that are different from one Industry to another).

In your case, you seem to have a slightly more complicated set up: Industry and Year are crossed random grouping factors and Company is a random grouping factor nested in Industry. Not sure whether the level-1 and level-2 terminology is correct in this setting where both crossing and nesting exist. To be on the safe side, you can refer to predictors as being industry predictors, company predictors and, if you have them, year predictors. (We don't know enough about your study design and research questions to confirm whether this type of set up actually makes sense for your data - we will assume that it does for the purposes of this answer.)

The problem with company predictors is that their effects can vary (1) across companies only, (2) across companies AND industries or (3) across industries only. The way you specified your model currently won't allow you to cover all of these situations. However, if you replace the construct (1|Industry/Company) with the equivalent construct (1|Industry) + (1|Industry:Company), you can cover all 3 situations and determine which one receives most support from your data:

Situation (1):

fit1_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 +
                           (1|Industry) + 
                           (1 + Z1 + Z2|Industry:Company) + 
                           (1|Year),
                           data = mydata, 
                           family = poisson(link = "log"))

Situation (2):

fit2_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 +
                           (1 + Z1 + Z2|Industry) + 
                           (1 + Z1 + Z2|Industry:Company) + 
                           (1|Year),
                           data = mydata, 
                           family = poisson(link = "log"))

Situation (3):

fit3_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 +
                           (1 + + Z1 + Z2|Industry) + 
                           (1|Industry:Company) + 
                           (1|Year),
                           data = mydata, 
                           family = poisson(link = "log"))

Note that in the above, I assumed that Company is nested in Industry and that the predictors measured at the company level were Z1 and Z2.

The 3 models formulated above are so-called random-intercept and random-slope models. For random-intercept models, the formulations:

fit_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 +
                           (1|Industry) + 
                           (1|Industry:Company) + 
                           (1|Year),
                           data = mydata, 
                           family = poisson(link = "log"))

and

fit_poissonGLMER <- glmer(Y1 ~ X1 + X2 + X3 + Z1 + Z2 +
                           (1|Industry/Company) +
                           (1|Year),
                           data = mydata, 
                           family = poisson(link = "log"))

are equivalent.

Isabella Ghement
  • 18,164
  • 2
  • 22
  • 46
  • Thanks Isabella, situation 2 captures my research context pefectly (i.e. firm-level predictors vary across companies and industries). I do have one little complication in the data, some board members sit on the board of more than one company. This is a minority of them, but still a sizable one. Could there be a way of specifying this in the model? – Charlie Glez Feb 08 '21 at 16:45
  • Every year some board members drop from the list and new are added, also not quite sure if the model handles this... – Charlie Glez Feb 08 '21 at 17:04
3

I realized that my comment above is general, so I'll submit it as an answer:

In lme4 syntax, fixed effects are entered as you have them here, and random effects are specified with the | operator. Correctly specifying the random effects is key to returning the correct fixed effect coefficient. It looks like you have specified the nesting of companies in industries correctly. You could also likely examine the difference in the fit of a models with Year modeled as fixed v. random. That's purely your choice.

Rick Hass
  • 328
  • 1
  • 8