Random effects specification in modeling panel (longitudinal) data I am fitting a negative binomial model with mixed effects on a dataset with repeated measures in time. Each observation is a province-year combination, meaning province 1 year 1, province 1 year 2, ..., province 1 year 10, province 2 year 1, ... province 20 year 10. So I am using random effects in the model for the intercept to account for the possible groupings among provinces and years. I added a random parameter to account for possible correlation for each province in different years and another one for different provinces in each year. In the lme4 format it is (1|province) + (1|year). I have seen another form of addressing these possible groupings by adding (year|province) instead of the above. This will add a random parameter for intercept based on province and then uses year as an explanatory variable with only random effects based on province. Which is the correct and common way to do this?
 A: A couple of notes:


*

*Random effects are translated to correlations for the corresponding grouping factor. That is, when you put province after the | symbol, you postulate that measurements on your outcome variable for the same province are correlated. Likewise, if you are going to put year after the | symbol, you assume that measurements on the same year are correlated. 

*When you put the 1 in front of the | symbol, e.g., (1 | province), you assume exchangeability. I.e, that measurements over the years in the same province are equally correlated (e.g., the correlation between year1 and year2 is equal to the correlation between year1 and year3 for the same province, etc.). Likewise if you put (1 | year), you assume that measurements from different provinces in the same year are equally correlated (e.g., the correlation in your outcome between province1 and province2 is equal to the correlation between province1 and province3 for the same year, etc.).

*If you will put the year in front of the | symbol, e.g., (year | province), you assume that measurements within the same province are correlated, and that this correlation decreases with the time lag. I.e., the correlation between year1 and year2 is stronger than the correlation between year1 and year3.

*Your study seems to be a longitudinal study in which the latter approach (i.e., (year | province)) seems to make more sense and it is more often used. Nonetheless, you could compare between the two to see which fits your data better.

*When estimating these models under maximum likelihood, you need to be aware of the method you use to approximate the integrals over these random effects. The lme4 package works with the Laplace approximation, which may not always work optimally. The gold standard numerical approximation method is considered to be the adaptive Gaussian quadrature, provided by the GLMMadaptive package.

