spey.backends.default_pdf.EffectiveSigma#
- class spey.backends.default_pdf.EffectiveSigma(signal_yields: ndarray | Callable[[ndarray], ndarray], background_yields: ndarray, data: ndarray, correlation_matrix: ndarray, absolute_uncertainty_envelops: List[Tuple[float, float]], modifiers: List[Dict[str, Any]] | None = None, n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#
Simplified likelihood with asymmetric (effective-sigma) background uncertainties (
default.effective_sigma).This backend handles asymmetric background uncertainties through the variable-Gaussian (effective-\(\sigma\)) approach of [arXiv:physics/0406120] Sec. 3.6, eqs. 18–19. Given per-bin upper and lower absolute uncertainties \(\sigma^+_i\) and \(\sigma^-_i\), an effective width is defined that depends on the nuisance-parameter value:
\[\sigma^{\rm eff}_i(\theta_i) = \sqrt{\sigma^+_i \sigma^-_i + (\sigma^+_i - \sigma^-_i)(\theta_i - n^b_i)},\]clipped from below at \(10^{-10}\) for numerical stability. The full likelihood is
\[\mathcal{L}(\mu, \boldsymbol{\theta}) = \prod_{i=1}^{N} \mathrm{Poiss}\!\left(n^{\rm obs}_i \,\Big|\, \mu\, n^s_i \cdot f(\boldsymbol{\theta}_{\rm sig}) + n^b_i + \theta_i\, \sigma^{\rm eff}_i(\theta_i)\right) \cdot \mathcal{N}(\boldsymbol{\theta} \mid \mathbf{0},\, \rho),\]where \(\rho\) is a user-supplied correlation matrix.
Note
The positivity constraint
\[n^b_i + \theta_i\, \sigma^{\rm eff}_i(\theta_i) \geq 0\]is enforced via a
NonlinearConstraintduring optimisation.When \(\sigma^+_i = \sigma^-_i \equiv \sigma_i\) the effective sigma reduces to the constant \(\sigma_i\), recovering the symmetric
CorrelatedBackgroundresult.- Parameters:
signal_yields (
np.ndarray | Callable[[np.ndarray], np.ndarray]) – Per-bin signal yields \(\{n^s_i\}\), or a callable that accepts the extra signal parameterspars[1 : 1 + n_signal_parameters]and returns the per-bin yields as anp.ndarray.background_yields (
np.ndarray) – Per-bin expected background yields \(\{n^b_i\}\).data (
np.ndarray) – Per-bin observed counts \(\{n^{\rm obs}_i\}\).correlation_matrix (
np.ndarray) – \(N \times N\) inter-bin correlation matrix \(\rho\).absolute_uncertainty_envelops (
List[Tuple[float, float]]) – Per-bin pairs \((\sigma^+_i, \sigma^-_i)\) of upper and lower absolute background uncertainties. Both values are taken as absolute (sign is ignored).modifiers (
List[Dict[str, Any]], defaultNone) –Optional list of signal-uncertainty modifier configuration dictionaries. Each dictionary must contain:
"type"(str, required): morphing mode, either"normalization"— one shared nuisance parameter for all bins (e.g. PDF uncertainties, luminosity);"shape"— one independent nuisance parameter per bin (e.g. scale uncertainties, theory prediction statistics).
"uncertainties"(List[float] | List[Tuple[float, float]], required): absolute uncertainty values per bin. Use a flatlist[float]for symmetric uncertainties, or alist[(up, down)]for asymmetric ones."name"(str, optional): label used for parameter naming; defaults to"mod0","mod1", …
Not supported when
signal_yieldsis a callable.Example:
modifiers = [ {"type": "normalization", "name": "pdf", "uncertainties": [0.6, 1.0]}, {"type": "shape", "name": "scale", "uncertainties": [(0.3, 0.4), (0.5, 0.6)]}, ]
n_signal_parameters (
int, default0) – Number of additional free parameters accepted by a callablesignal_yields. Has no effect whensignal_yieldsis a plain array. SeeDefaultPDFBasefor the parameter-vector layout.signal_parameter_bounds (
List[Tuple[Optional[float], Optional[float]]] | None) – Optimiser bounds for each extra signal parameter. Each entry is a(lower, upper)pair; useNonefor an unbounded side. WhenNone, every extra signal parameter receives(None, None). Must have exactlyn_signal_parametersentries when provided.
References
Barlow, R., Asymmetric Errors, [arXiv:physics/0406120] Sec. 3.6, eqs. 18–19.
- __init__(signal_yields: ndarray | Callable[[ndarray], ndarray], background_yields: ndarray, data: ndarray, correlation_matrix: ndarray, absolute_uncertainty_envelops: List[Tuple[float, float]], modifiers: List[Dict[str, Any]] | None = None, n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#
Methods
__init__(signal_yields, background_yields, ...)asimov_negative_loglikelihood([poi_test, ...])Compute the profiled negative log-likelihood at fixed \(\mu\) on Asimov data.
combine(other, **kwargs)Combine this statistical model with another backend instance.
config([allow_negative_signal, poi_upper_bound])Model configuration.
expected_data(pars[, include_auxiliary])Compute the expected data vector at the given parameter point.
get_hessian_logpdf_func([expected, data])Return a callable that evaluates the Hessian of \(\ln\mathcal{L}(\mu, \boldsymbol{\theta})\).
get_logpdf_func([expected, data])Return a callable that evaluates \(\ln\mathcal{L}(\mu, \boldsymbol{\theta})\).
get_objective_function([expected, data, do_grad])Return the objective function \(-\ln\mathcal{L}(\mu, \boldsymbol{\theta})\) used by the optimiser.
get_sampler(pars)Return a callable that draws pseudo-data from the statistical model.
minimize_asimov_negative_loglikelihood([...])Find the global minimum of the negative log-likelihood on Asimov data (free fit).
minimize_negative_loglikelihood([expected, ...])Find the global minimum of the negative log-likelihood (free fit).
negative_loglikelihood([poi_test, expected])Compute the profiled negative log-likelihood at a fixed \(\mu\).
Attributes
constraintsConstraints to be used during optimisation process
signal_uncertainty_configurationarXivarXiv reference for the backend
authorAuthor of the backend
constraint_modelConstraint model distribution \(\mathcal{C}(\boldsymbol{\theta})\).
doiCitable DOI for the backend
is_aliveReturns True if at least one bin has non-zero signal yield.
main_modelMain model distribution — the Poisson term of the likelihood.
nameName of the backend
spey_requiresSpey version required for the backend
versionVersion of the backend