pyhf.infer.test_statistics.tmu_tilde

pyhf.infer.test_statistics.tmu_tilde(mu, data, pdf, init_pars, par_bounds, fixed_params)[source]

The test statistic, \(\tilde{t}_{\mu}\), for establishing a two-sided interval on the strength parameter, \(\mu\), for models with bounded POI, as defiend in Equation (11) in [1007.1727]

\[\tilde{t}_{\mu} = -2\ln\tilde{\lambda}\left(\mu\right)\]

where \(\tilde{\lambda}\left(\mu\right)\) is the constrained profile likelihood ratio as defined in Equation (10)

\begin{equation} \tilde{\lambda}\left(\mu\right) = \left\{\begin{array}{ll} \frac{L\left(\mu, \hat{\hat{\boldsymbol{\theta}}}(\mu)\right)}{L\left(\hat{\mu}, \hat{\hat{\boldsymbol{\theta}}}(0)\right)}, &\hat{\mu} < 0,\\ \frac{L\left(\mu, \hat{\hat{\boldsymbol{\theta}}}(\mu)\right)}{L\left(\hat{\mu}, \hat{\boldsymbol{\theta}}\right)}, &\hat{\mu} \geq 0. \end{array}\right. \end{equation}

Example

>>> import pyhf
>>> pyhf.set_backend("numpy")
>>> model = pyhf.simplemodels.hepdata_like(
...     signal_data=[12.0, 11.0], bkg_data=[50.0, 52.0], bkg_uncerts=[3.0, 7.0]
... )
>>> observations = [51, 48]
>>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata)
>>> test_mu = 1.0
>>> init_pars = model.config.suggested_init()
>>> par_bounds = model.config.suggested_bounds()
>>> fixed_params = model.config.suggested_fixed()
>>> pyhf.infer.test_statistics.tmu_tilde(test_mu, data, model, init_pars, par_bounds, fixed_params)
array(3.93824492)
Parameters
  • mu (Number or Tensor) – The signal strength parameter

  • data (Tensor) – The data to be considered

  • pdf (Model) – The statistical model adhering to the schema model.json

  • init_pars (list) – Values to initialize the model parameters at for the fit

  • par_bounds (list of lists or tuples) – The extrema of values the model parameters are allowed to reach in the fit

  • fixed_params (list) – Parameters held constant in the fit

Returns

The calculated test statistic, \(\tilde{t}_{\mu}\)

Return type

Float