# Variable slopes in a fixed effects model

In a mixed effects model the fixed effects allow for different y intercepts for given fixed effects. It does not allow the slopes to change where as random effect allows the slopes and intercept to change. Why do the fixed effects have this limitation?

For example, I might have height vs recorded at 10,11,12,13,14,15 years of age for some boys and girls. It seems reasonable to me that in boys the height vs age slope would be steeper than in girls. But modelling boys vs girls as fixed effects won't allow for different slopes where as random effects will. But boy and girl are fixed effects so a random effect model seems inappropriate. What would be the appropriate way to model something like this in a mixed effects model?

Thanks

There seems to be some confusion in your question. The purpose of random effects (intercepts) in a growth model, is to account for the correlations within individuals. The difference in slope that you expect, between boys and girls would be modelled with an interaction between the slope (ie the fixed effect for the time variable) and sex. Additionally, you can allow each subject to have their own slope, or rather an offset from the fixed slope, by fitting random slopes.

You say:

boy and girl are fixed effects so a random effect model seems inappropriate

This is correct. Sex is a fixed effect.

In the example in your question you would fit a model such as:

height ~ sex * time + (1 | subject)


This will estimate an overall linear trend for time (the fixed effect for time) for both boys and girls (the fixed effect for sex) and also allow trend to be different for boys and girls (the sex:time interaction), while also adjusting the dependence between measurements in each person (the subject random intercept).

As mentioned in the first paragraph, You could also allow each subject to have their own slope by fitting random slopes for time:

height ~ sex * time + (time | subject)

• Thank you very much. In most of the examples I have looked at the haven't included an interaction term but this makes sense. Feb 20, 2020 at 8:36