spey.backends.default_pdf.ThirdMomentExpansion#
- class spey.backends.default_pdf.ThirdMomentExpansion(signal_yields: ndarray, background_yields: ndarray, data: ndarray, covariance_matrix: ndarray, third_moment: ndarray, signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#
Simplified likelihood interface with third moment expansion. Third moment expansion follows simplified likelihood construction and modifies the \(\lambda\) and \(\Sigma\). Using the expected background yields, \(m^{(1)}_i\), diagonal elements of the third moments, \(m^{(3)}_i\) and the covariance matrix, \(m^{(2)}_{ij}\), one can write a modified correlation matrix and \(\lambda\) function as follows
\[ \begin{align}\begin{aligned}C_i &= -sign(m^{(3)}_i) \sqrt{2 m^{(2)}_{ii}} \cos\left( \frac{4\pi}{3} + \frac{1}{3}\arctan\left(\sqrt{ \frac{8(m^{(2)}_{ii})^3}{(m^{(3)}_i)^2} - 1}\right) \right)\\B_i &= \sqrt{m^{(2)}_{ii} - 2 C_i^2}\\A_i &= m^{(1)}_i - C_i\\\rho_{ij} &= \frac{1}{4C_iC_j} \left( \sqrt{(B_iB_j)^2 + 8C_iC_jm^{(2)}_{ij}} - B_iB_j \right)\end{aligned}\end{align} \]which further modifies \(\lambda_i(\mu, \theta) = \mu n^i_{sig} + A_i + B_i \theta_i + C_i \theta_i^2\) and the multivariate normal has been modified via the inverse of the correlation matrix, \(\mathcal{N}(\theta | 0, \rho^{-1})\). See [arXiv:1809.05548] Sec. 2 for details.
- Parameters:
signal_yields (
np.ndarray) – signal yieldsbackground_yields (
np.ndarray) – background yieldsdata (
np.ndarray) – observationscovariance_matrix (
np.ndarray) – covariance matrix (square matrix)third_moment (
np.ndarray) – third moment for each region.signal_uncertainty_configuration (
Dict[Text, Any]], defaultNone) –Configuration input for signal uncertainties
absolute_uncertainties (
List[float]): Absolute uncertainties for the signal- absolute_uncertainty_envelops (
List[Tuple[float, float]]): upper and lower uncertainty envelops
- absolute_uncertainty_envelops (
correlation_matrix (
List[List[float]]): Correlation matrixthird_moments (
List[float]): diagonal elemetns of the third moment
Note
Each input should have the same dimensionality, i.e. if
datahas three regions,signal_yieldsandbackground_yieldsinputs should have three regions as well. Additionallycovariance_matrixis expected to be square matrix, thus for a three region statistical model it is expected to be 3x3 matrix. Following these,third_momentshould also have three inputs.- __init__(signal_yields: ndarray, background_yields: ndarray, data: ndarray, covariance_matrix: ndarray, third_moment: ndarray, signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#
Methods
__init__(signal_yields, background_yields, ...)asimov_negative_loglikelihood([poi_test, ...])Compute negative log-likelihood at fixed \(\mu\) for Asimov data.
combine(other, **kwargs)A routine to combine to statistical models.
config([allow_negative_signal, poi_upper_bound])Model configuration.
expected_data(pars[, include_auxiliary])Compute the expected value of the statistical model
get_hessian_logpdf_func([expected, data])Currently Hessian of \(\log\mathcal{L}(\mu, \theta)\) is only used to compute variance on \(\mu\).
get_logpdf_func([expected, data])Generate function to compute \(\log\mathcal{L}(\mu, \theta)\) where \(\mu\) is the parameter of interest and \(\theta\) are nuisance parameters.
get_objective_function([expected, data, do_grad])Objective function i.e. twice negative log-likelihood, \(-2\log\mathcal{L}(\mu, \theta)\).
get_sampler(pars)Retreives the function to sample from.
minimize_asimov_negative_loglikelihood([...])A backend specific method to minimize negative log-likelihood for Asimov data.
minimize_negative_loglikelihood([expected, ...])A backend specific method to minimize negative log-likelihood.
negative_loglikelihood([poi_test, expected])Backend specific method to compute negative log-likelihood for a parameter of interest \(\mu\).
Attributes
constraintsConstraints to be used during optimisation process
signal_uncertainty_configurationarXivarXiv reference for the backend
authorAuthor of the backend
constraint_modelretreive constraint model distribution
doiCitable DOI for the backend
is_aliveReturns True if at least one bin has non-zero signal yield.
main_modelretreive the main model distribution
nameName of the backend
spey_requiresSpey version required for the backend
versionVersion of the backend