I am familiar with Levene's test (Wikipedia link) for equality of variances, which is robust to non-normality, but assumes observations are independent. Today I was wondering what to do when you want to compare variances between two samples, but observations are not independent. For instance, in panel data, an individual is observed through time, and may be grouped with other individuals in a cluster, making it very likely that observations are not independent.
The heart of the Levene's test is the spread measure $z_{ij} = |x_{ij} - \mu_{i}|$, the absolute deviation of an observation $j$ in group $i$ with group mean $\mu_{i}$. In reality, $\mu_{i}$ is not known, so an estimate $\hat{\mu}_i$ is used instead. The authors of this interesting review of Levene's test point out that instead of using the sample mean (or median), one can use a more robust estimate. This got me thinking: if you could estimate $\mu_i$ in a way that controls for issues that arise in panel data (e.g. observations correlated across time and individuals/cross-sections) then you could substitute that into Levene's test and fire away. But is this in fact true?
Then I read Ben Bolker's response to a somewhat similar question. If I understand him correctly, comparisons of variances amount to comparisons of conditional distributions, since problems like heteroskedasticity and autocorrelation are captured in the error term of a regression. He thus advises comparing the residuals of a regression. Is this the right path?
Or, is Levene's test robust to any issues brought up by panel data?