# Idea for an using of mixed model. Used variable with all possible category as an random effect

I've got some problem:

Check the relationship between income tax income and migration in Polish "powiats" (an administrative unit in Poland, something like a county in the US). I have data in this regard for individual years. I think a good model would be:

Tax_income ~ balance_of_migration + year + (1|powiat).

However, I am not sure about it because of one thing. I know that random effects should be used, when we have a factor with levels that have been drawn from a population of possible samples.The situation is different here. I have all counties. However, my intuition tells me that my model is good for my problem, because I want to take into account the fact of repeated observations for powiats, but I am not interested what is the change in the values ​​of the endogenous variable for individual powiats (however, it will be a good idea to assess the variability (variance) between counties).

What do you think: can I use 'powiats' as an random effect in model?

This is an interesting question. Indeed, understanding random effects $$u_i$$ as draws from a larger population is well in line with the underlying model, which treats them as a random variable, e.g.:

$$u_i \sim_{iid} Normal(0, \sigma^2)$$

But there are arguments for treating entities as coming from a larger population even if your sample is a full census. Any realized set of entities can be viewed as "chosen at random by Nature", an argument made by Freedman (2005). Relatedly, Deming (1953) has argued that if a full census is used to solve a, what he calls, analytical problem, i.e., when inferring an underlying relationship or process with the goal to generalize (as in your case) rather than just count, even a full census should be treated as a sample with sampling error. This would also justify the view of your counties coming from a larger distribution (in Deming's words, coming from the "causal system" that produced it).

It will probably depend on your discipline how strictly people treat the different assumptions made in random effect models, but the random effect independence assumption is probably more relevant and empirically verifiable than what you view as your population of counties. Given the efficiency advantage of RE over FE models and the convenient estimation of between-county variance in RE models, which is one of your side goals, I would advise for the RE model (given other assumptions, like the independence assumption, make sense in your context and do no harm).

References:

Freedman D. A. (2005). Statistical Models: Theory and Practice. Cambridge, UK: Cambridge University Press.

Deming, W. E. (1953). On the distinction between enumerative and analytic surveys. Journal of the American Statistical Association, 48(262), 244-255.

Yes I think your intuition is correct and you can fit random intercepts. There are several criteria for assessing if a factor should be treated as random and being a sample from a population is only one. Often different criteria point in different directions and it is a matter of judgement. In this case if you really wanted to be strict about it you can think of your population as a sample from a population of similar entities in similar countries - or as a sample from a population in a different universe! I say that lightheartedly of course. The fact is that you have clustered data and this is one of the main use cases for random effects.