How can I average the variance extracted from different group of samples? I have groups of samples, where each group has a different number of samples and a different mean. I also know the variance of each group of samples. I would like to compute a sort of "average" variance, that should be something like the mean of my variances.
If the groups had all the same number of units, I think I could simply average the variances of each group summing up the variances and dividing by the number of groups.
However my groups have different sizes and I should, somehow, keep this into account.
How can I proceed?
 A: The precise answer to your question depends on what are you going do to with it, but a possible answer could be to calculate the pooled variance. The poled variance is a method for estimating the variance of several different populations when the mean of each population may be different, but one may assume that the variance of each population is the same.
Suppose you have $k$ groups, the (corrected) sample variances $s_1^2, \ldots,s_k^2$ and the group size is $n_1,\ldots, n_k$. Then the pooled variance is
$$
s_{pool}^2 =\frac{(n_1-1)s_1^2+\cdots+(n_k-1)s_k^2}{(n_1-1)+\cdots+(n_k-1)}.
$$
Quoting from Wikipedia's page

If we can assume that the same phenomena are generating random error
at every level of $x$, the above data can be “pooled” to express a
single estimate of variance and standard deviation. In a sense, this
suggests finding a mean variance or standard deviation among the five
results above.

which, to me seems to answer what you are looking for.
A: One logical approach is to meta-analyze the variance, you can then either look at the inference about the mean of studies/experiments/samples or about the prediction for a new unseen study (or any particular study, you've already seen). There's a vignette on this for the RBesT R package.
This is all based on the observation (see e.g. Schmidli et al. 2017) that - assuming a normal distribution for the data (at least after suitable transformation - the sampling distribution of the estimate of the (residual) variance of an group in a study with $n$ patients/samples follows a $\Gamma(\nu/2, \nu/(2 \sigma^2))$ distribution, where $\sigma$ is the true variance. We would typically use $\nu = (n-1)$ when the residual variance is from a linear model with just an intercept per group. Note that we use the parameterization of the $\Gamma$-distribution in terms of a shape and a rate parameter (sadly, there's many versions around). You can then assume that $\log(\sigma_i)$ for study $i$ varies across studies $i=1,\ldots,I$ according to e.g. a normal distribution.
