Correlation between errors and hetereoskadacity typically come up with regression, but can these same concepts come into play with the sample mean? I know hetereoskadacity itself does not make sense since it is about conditional variances, but I could think of each X$_i$ having its own variance, and that within sum subgroups, the X$_i$'s are correlated. so for example, say I have a geographic group g, so I can label my X's as X$_{i,g}$, and I assume Var(X$_{i,g}$) = $\sigma_i^2$, and for each observation within a given group g, cov(x$_{i,g}$, X$_{j,g}$) $\neq$ 0?
In which case, the variance of X$_i$ would become (for simplicity, assume g and g' are the only reasons, with two observations in each just because I can't think of the concise way to write this as a summation)
$\sigma_{1,g}^2$ + $\sigma_{2,g}^2$ + cov(x$_{1,g}$,x$_{j,g}$) + $\sigma_{1,g'}^2$ + $\sigma_{2,g'}^2$ + cov(x$_{1,g'}$,x$_{j,g'}$).
Does this logic even make sense, theoretically and practically? For regression it is obvious that it is, but is there a real life application where this is the case, and how does this influence on sample t tests, confidence intervals for the sample mean etc. Is it something that can conceivable occur with a non 'simple random sample' for example for stratified samples?