I am dealing with the following data frame:

GroupID Month Year   Concession_10Yr  Action  Historical_Action_5Yr
XY1       12   1984     1                0                 0

Here GroupID is a unique identifier for an organization. Then we have data every ear and month on whether the organization took "action", whether there was a "concession" (think "treatment") to this organization over the past 10 years and then whether the organization took action over the last 5 years.

What I'm trying to do is model the probability of an organization taking action. Clearly I can't do a simple linear regression as the organizations would be correlated with one another as some organizations are more likely to take action then others.

As such, I was thinking of a non-linear mixed effects model, something like:

lmer(Action ~ GroupID + Historical_Action_5Yr + Concession_10Yr +
     1/GroupID/Concession_10Yr + 1/GroupID/Historical_Action_5Yr, 
     family = binomial(link = logit)

However, I am not sure that I have the nesting correct. Also, this doesn't account for time directly...

Any guidance would be much appreciated!


According to this paper about the package, the (1 | g1/g2) (or the equivalent (1 | g1)+(1 | g1:g2)) notation means:

Intercept varying among g1 and g2 within g1

Thus your model consists of the following parts:

  • A fixed effect for GroupID
  • A fixed effect for Historical_Action_5Yr
  • A fixed effect for Concession_10Yr
  • An intercept varying for GroupID and an intercept for Concession_10Yr withing GroupID, noted as (1 | GroupID/Concession_10Yr)
  • An intercept for GroupID and an intercept for Historical_Action_5Yr within GroupID, noted as (1 | GroupID/Historical_Action_5Yr). Since there is already an intercept varying for GroupID you could also use (1 | GroupID:Historical_Action_5Yr) to compute the intercept for all combinations of GroupID and Historical_Action_5Yr.

In short:

lmer(Action ~ GroupID + Historical_Action_5Yr + Concession_10Yr + (1 |GroupID/Concession_10Yr) + (1 | GroupID:Historical_Action_5Yr), family = binomial(link =logit)
  • $\begingroup$ Hi Pieter: That's the thing, I'm not quite sure I need all combinations of GroupID & Historical_Action_5YR -- I'm looking for some help on how the model should be? $\endgroup$ Jan 7 '17 at 20:34
  • $\begingroup$ There no such thing as a correct answer on that. You should think about what you think the relations are like. The data could also guide you to an answer. Start by learning a simple model and check the coefficients and error distribution. If the latter it is normally distributed and the spread is small enough, you're done :) If not, include additional variable (interactions) and check if they make sense (correct direction?) and if they add something. $\endgroup$
    – Pieter
    Jan 7 '17 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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