spey.backends.default_pdf.ThirdMomentExpansion

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 yields

  • background_yields (np.ndarray) – background yields

  • data (np.ndarray) – observations

  • covariance_matrix (np.ndarray) – covariance matrix (square matrix)

  • third_moment (np.ndarray) – third moment for each region.

  • signal_uncertainty_configuration (Dict[Text, Any]], default None) –

    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

    • correlation_matrix (List[List[float]]): Correlation matrix

    • third_moments (List[float]): diagonal elemetns of the third moment

Note

Each input should have the same dimensionality, i.e. if data has three regions, signal_yields and background_yields inputs should have three regions as well. Additionally covariance_matrix is expected to be square matrix, thus for a three region statistical model it is expected to be 3x3 matrix. Following these, third_moment should 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

constraints

Constraints to be used during optimisation process

signal_uncertainty_configuration

arXiv

arXiv reference for the backend

author

Author of the backend

constraint_model

retreive constraint model distribution

doi

Citable DOI for the backend

is_alive

Returns True if at least one bin has non-zero signal yield.

main_model

retreive the main model distribution

name

Name of the backend

spey_requires

Spey version required for the backend

version

Version of the backend