Suppose I am modeling the sales by week for all 50 states in the United States for a beverage company and I want to see the effect of marketing on sales. Would adding a fixed effect and a random interaction by state make sense mathematically? Or are there issues with matrix invertability or any other issues? I know random effects are typically added if the level is drawn at random from a population of levels for that factor in experimental design so want to know if it makes sense in this case. I would then derive the final coefficient of the marketing variable as the sum of the fixed effect coefficient and random effect coefficient.


1 Answer 1


Assuming that you have multiple or repeated measures/observations per state, then yes, it makes sense to fit random intercepts for state. You are correct that random effects are used when the observed levels of a factor are taken from a wider population, however that is not the only justification. If you have a large number of levels and there is correlation of observations within each level, then fitting random intercepts is usually a good idea otherwise results could be biased.

I would then derive the final coefficient of the marketing variable as the sum of the fixed effect coefficient and random effect coefficient.

This doesn't really make sense. You would only be interested in the fixed effect of the marketing variable. You also mentioned:

random interaction by state

This also doesn't quite make sense. The state variable would only enter the model as a random intercept (because it is a grouping factor). The model may look something like this:

sales ~ marketing + other_variables + (1 | state)

and, as mentioned, you interest would centre on the marketing variable. If you wished to allow the effect of marketing to vary by state, which is what I am guessing you meant by "random interaction by state" then you could fit random slopes for marketing:

sales ~ marketing + other_variables + (marketing | state)

In most software the random effects are assumed to be normally distributed with a mean of zero, so the overall effect of marketing will simply come from the fixed effect for it.

  • $\begingroup$ Even if the mean of the random effects is zero for all 50 states, could you still interpret the marketing coefficient for each state as the fixed effect of random effect? $\endgroup$
    – lord12
    Commented Jan 14, 2020 at 17:05
  • $\begingroup$ Only the mean of the random effects is zero. You will still get an estimate for the fixed effect of marketing that is readily intepretable. You could extract the random effect for each state if you wanted and then get individual overall effects for each state. $\endgroup$ Commented Jan 14, 2020 at 17:07
  • $\begingroup$ I am interpreting the fixed effect as a "national coefficient" and the random effect as the "state random effect" which is why I summed both the fixed and random effects so the coefficients vary by state even if the deviations are mean 0. $\endgroup$
    – lord12
    Commented Jan 14, 2020 at 17:11
  • $\begingroup$ Do you know any good resources that explain mixed models in the context of econometric modeling. Most resources deal with mixed models in the context of experimental design, but are there resources/courses that explain how to use mixed models for non-typical use cases like the one I mentioned above? Thanks for your help $\endgroup$
    – lord12
    Commented Jan 14, 2020 at 17:16
  • 1
    $\begingroup$ I don't know anything specifically for econometrics but there is a big literature on longitudinal modelling with mixed models. Check out the course by @DimitrisRizopoulos who is on here for starters. Your case is not non-typical :) $\endgroup$ Commented Jan 14, 2020 at 17:24

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.