spey.backends.default_pdf.third_moment.compute_third_moments#
- spey.backends.default_pdf.third_moment.compute_third_moments(absolute_upper_uncertainties: ndarray, absolute_lower_uncertainties: ndarray, return_integration_error: bool = False) Tuple[ndarray, ndarray] | ndarray[source]#
Estimate the diagonal third central moments \(\{m^{(3)}_i\}\) from asymmetric uncertainty envelopes using a bifurcated Gaussian model.
When only the upper and lower uncertainty envelopes \((\sigma^+_i, \sigma^-_i)\) are available (rather than the full background distribution), the background fluctuation in bin \(i\) is modelled as a bifurcated Gaussian:
\[\begin{split}p_i(\theta) = \frac{2}{\sigma^+_i + \sigma^-_i} \begin{cases} \mathcal{N}(\theta \mid 0,\, \sigma^-_i), & \theta < 0, \\ \mathcal{N}(\theta \mid 0,\, \sigma^+_i), & \theta \geq 0. \end{cases}\end{split}\]The third central moment of this distribution is
\[m^{(3)}_i = \mathbb{E}_i[\theta^3] = \frac{2}{\sigma^+_i + \sigma^-_i} \left[ \sigma^-_i \int_{-\infty}^{0} \theta^3\, \mathcal{N}(\theta \mid 0, \sigma^-_i)\,d\theta + \sigma^+_i \int_{0}^{\infty} \theta^3\, \mathcal{N}(\theta \mid 0, \sigma^+_i)\,d\theta \right],\]which is evaluated numerically via
scipy.integrate.quad().Note
The \(k\)-th central moment of a distribution \(p\) is defined as
\[m^{(k)} = \mathbb{E}[(X - c)^k] = \int_{-\infty}^{\infty} (x - c)^k\, p(x)\, dx,\]with \(c = 0\) for the bifurcated Gaussian (which is already centred).
Attention
third_moment_expansion()requires \(8\,\Sigma_{ii}^3 \geq (m^{(3)}_i)^2\). Because this function derives \(m^{(3)}_i\) independently from the covariance matrix, the condition is not guaranteed to hold. Whether it is satisfied depends on the interplay between the envelopes and the diagonal of \(\Sigma\).- Parameters:
absolute_upper_uncertainties (
np.ndarray) – Per-bin upper absolute uncertainties \(\{\sigma^+_i\}\) (positive values).absolute_lower_uncertainties (
np.ndarray) – Per-bin lower absolute uncertainties \(\{\sigma^-_i\}\) (positive values; signs are taken as absolute internally).return_integration_error (
bool, defaultFalse) – IfTrue, also return the per-bin numerical integration errors fromscipy.integrate.quad().
- Returns:
Array of diagonal third moments \(\{m^{(3)}_i\}\) (shape \(N\)). When
return_integration_error=True, a 2-tuple(third_moments, errors)is returned.- Return type:
np.ndarrayorTuple[np.ndarray, np.ndarray]