Does sample size affect choice between fixed and random effect I am analyzing data as given in this question: Should "City" be a fixed or a random effect variable?
Here it is debatable whether "City" is to be kept as fixed effect or random effect.
Will the sample size affect this choice?
I think, if sample size is large, either fixed or random effect approach can be chosen. But I am not sure which approach will remain valid if sample size is small.
Also, I would like to know how to determine sample size in this situation?
 A: Some care is needed when talking about samples size in the context of mixed models.
First, there is the overall (total) sample size, let's call it $N$
Then there is the number of subjects (cities in the case of your example), let's call it $n$
Then there is the number of observations within each subject (city). In observational studies this will often be different between each subject, so we need to index it. Let's index it by $i$ and call it $m_{i} \quad \forall i \in [1..n]$
Obviously we have that
$$ \sum_{i=1}^{n} m_i = N$$
Note that apart from this condition, $N$ and $n$ are unrelated. $N$ could be very large, while $n$ can be small. For example in your case of cities you might samples thousands of participants from only 4 cities. $n$ is still 4, and exactly the same considerations apply as in your other question
On the other hand we could have that $N$ is small and $n$ is large (subject to the condition noted above) which means we can have small clusters. In general, the question around the minimum sample size for the $m_i$ is a little tricky. Basically the minimum is 1, but if there are too many singleton clusters, there are going to be issues with statistical power and possibly model convergence. This question and it's answers should provide more background and detail on that.
Then there is also another quantity known as the "effective sample size". This is related to the extent of correlation within the clusters. If there is no correlation, then random intercepts are not needed and the effective sample size is $N$, however when there are correlations then this is reduced by what is known as the design effect, $DE$:
$$ DE = 1 +(m-1)\rho$$
where $m$ is the average cluster size and $\rho$ is the intraclass correlation coefficient (variance partition coefficient), and this applies when calculating sample sizes needed for overall linear statistics (means and totals). For regression coefficients it is a little more complicated.
