0
$\begingroup$

I have a question about normal linear models vs mixed models.

Say I'm predicting prices for certain products, and I know two things: store and brand:

In a linear model (lm), this would be:

price ~ 1 + store + brand

in a mixed effects model (lmer from lme4), this would be

price ~ 1 + (1 | store) + (1 | brand)

I keep on reading that mixed effects models are great because e.g. different stores have different effects (think Whole Foods vs Costco, expensive vs cheap), but I don't see how a normal linear model doesn't track that anyways. If store and brand are factors, then doesn't each unique store get transformed into its own boolean variable? (For each price i, it was or it was not gathered from store j, so if there are ten different stores, that'll be turned into ten different indicator columns in the data matrix X).

How exactly does a mixed effects model do better than this?

$\endgroup$
  • $\begingroup$ You might want to look for the difference between fixed and random effects. $\endgroup$ – usεr11852 Feb 24 '15 at 22:56
1
$\begingroup$

Random effects will have a different intercept for each group. Thus, each store will have a different intercept vs a common intercept. If each store is an indicator, the result is exactly the same. Imagine you had 100 stores, that means 100 indicators, not very easy to understand.

Gelman talks about this on pg 346 of his multilevel modeling book.

$\endgroup$
  • $\begingroup$ Is that a legal copy of Gelman & Hill? If not, it needs to be deleted from the site. You can always reference the book & link to, say, amazon. $\endgroup$ – gung - Reinstate Monica Feb 24 '15 at 22:53
  • $\begingroup$ @Gung It is (fortunately) not our responsibility to police all links. However, if such a link appears to be to a copy of questionable legality, we can expect it to become invalid soon, limiting its usefulness. $\endgroup$ – whuber Feb 24 '15 at 23:22
  • $\begingroup$ "If each store is an indicator, the result is exactly the same." Perhaps I am misunderstanding what you are writing here, but I don't think that this is correct. The OLS solution with a dummy for each store should not give the same estimates in general as a mixed effects model with a random intercept for slope. The predicted store-level random intecepts in LMM are shrunk towards the grand mean, especially for stores that have few observations. So the store-level predictions from the models should not be the same. Also, the degrees of freedom differ between the models. $\endgroup$ – Phil Oct 1 '18 at 6:50

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.