1.  Bias for non gaussian distribution :

We know that the Cl's at follow a chi2 distribution of 2*(ell+1) dof. We'd like to caracterize the bias of the Cl sample mean.

From https://en.wikipedia.org/wiki/Chi-squared_distribution#Sample_mean, we have that the sample mean of n chi2 variables of degree k is distributed according to a gamma distribution. The latter converge towards a normal distribution as n goes to infinity. This can be verified easily, by taking nn=1000 sample means of n=1000 C_{\ell=0} , generated at nside=1 :

Here, the plot is an histogram of the 1000 spectrum means <C_{\ell=2}> , and add a normal distribution with same mean and std for comparison.

For xQML, we have n_{MC} =100000 simulations. Hence, we can safely assume that each mean spectrum <C_{\ell}> are normally distributed. If V_{\ell\ell'} is the covariance of the spectrum, we can compute the chi2 using the formula

\displaystyle \chi^2 = \frac{ (<\hat C_\ell> - \tilde C_\ell)^T [V^{-1}]_{\ell\ell'} (<\hat C_{\ell'}> - \tilde C_{\ell'}) }{2 n_{\rm bins} n_{\rm MC}}

with \hat C_{\ell} = [\hat C^{EE}_{\ell}, \hat C^{BB}_{\ell}] the spectrum array estimation, and \tilde C_{\ell} the spectrum model.

2.  Comparison sample (mc) variance and analytical variance :

How to verify that the sampling variance correspond to the analytical one. In the framework of CMB spectrum, the Cl distribution is non gaussian at large angular scale. We cannot apply the chi2 test to they variance.