Principles for deciding to model a variable as both random and fixed in the same analysis

There are quite a lot of questions which touch on this issue, but there does not seem to be any that sets out any general principles for deciding when it would be a good idea (or a bad idea, or a pointless but non-harmful idea) to model a variable as both random and fixed.

There is a question which presently has a similar title, but which on further inspection is mostly focusing on one specific situation. There's another question which talks about the case of a binary variable, and in which the general impression from the comments seems to be that modelling the variable as random and fixed is always pointless.

• (+1) This is an interesting question, it comes up occasionally and is almost always very tricky.The only times I can see that it makes sense is when the factor is treated as a fixed effect and then also interacted with a random effect in the random structure. So the simplest situation would be y ~ fixed.factor + (1|fixed.factor:random.factor). I don't think it ever makes sense to have y ~ fixed.factor + (1|fixed.factor) + (1|random.factor)and now I am trying to think of general sitatuation / general principles ! In the linked question which cites the Barr paper, I don't think it arises. Jul 8 '20 at 5:25
• For the avoidance of doubt, this is about the situation where a fixed effect factor also appears as a grouping variable in the random structure (ie random intercepts) - not random slopes - right ? ? Jul 8 '20 at 5:28