# fixed effects vs random effects vs random intercept model

This might sound a repetitive question but after reading many articles and posts online, I could never understand it entirely. I read somewhere that a random intercept model is a type of random effect model. But I thought that in a fixed effect model we were also assuming random intercepts, one per each unit of interest. Also because we are looking "within" the unit, as in, at each unit. Can you please clarify?

Would you be able to clarify what is a mixed model as well please?

• Could you 1) include 1-2 references to the random intercept model, you are mentioning, 2) include 2-3 formula's for these types of models? This will help the members of this forum. Thx. Aug 29 '20 at 19:50

I read somewhere that a random intercept model is a type of random effect model.

Yes, this is correct. Random intercepts are random effects.

But I thought that in a fixed effect model we were also assuming random intercepts, one per each unit of interest.

No, in a fixed effects model, the fixed effects are, fixed. They don't vary by subject or any other unit of interest. The model will estimate one parameter for each fixed effect.

Also because we are looking "within" the unit, as in, at each unit. Can you please clarify?

I'm not sure what you mean here. With mixed models, the fixed effects estimates are "within". If you want to account for "between" effects then you can fit contextual effects by using group means, and offsets from group means.

Would you be able to clarify what is a mixed model as well please?

A mixed model is a model that has fixed effects, and random effects. For example, suppose we have repeated measures within subjects, and we have 6 subjects. We might fit the mixed effects model:

 y ~ X + (1| subject)


and this will fit a model with a fixed effect for X and a random effect (random intercept in this case) for subject.

We could also fit a fixed effects model:

y ~ X + subject


and this will fit a model with a fixed effect for X and fixed effects for each leel of subject.

Both models should provide a good estimate for X but as the number of subjects increases there will be better statistical power, and interpretabilty, with the mixed model.

• @Daniela Rodrigues Does this answer your question ? If so, please consider marking it as the accepted answer. If not, please let us know why. Sep 10 '20 at 18:43
• Sorry for the delay - By looking at your model y ~ X + subject, does it mean a fixed effect is a independent variable? Would you be able to provide a graphical representation of fixed effect, random effect and mixed models? I am still confused. Sep 11 '20 at 11:30
• Yes fixed effects are independent variables. I'm not sure what you mean by a graphical representation. You can think of a simple X-Y plot. The fixed effect for X is the slope. In a model with random intercepts for subjects, each subject has their own intercept and all the intercepts are assumed to follow a normal distribution. If subjects are fixed effects instead then each subject has its own offset from the intercept. Sep 11 '20 at 11:50
• But having their own intercept or an offset from the intercept isn't the same thing? In my mind an offset from the intercept means that for a different subject the regression line will start at a different point (intercept). Sep 11 '20 at 14:34
• Yes it's basically the same thing. They both have their own offsets, but with fixed effects each subject one consumes one degree of freedom, wherea with random intercepts only a variance is estimated (because they are assumed to be normally distributed), so that's why it makes sense to have fixed effects for small numbers of subjects and random intercepts for lrage numbers. Yes, you are correct that you can think of it as each regression line starts at a different point on the y axis (but all having the same slope) Sep 11 '20 at 14:51