WStatCountsStatistic¶
-
class
gammapy.stats.
WStatCountsStatistic
(n_on, n_off, alpha, mu_sig=None)[source]¶ Bases:
gammapy.stats.counts_statistic.CountsStatistic
Class to compute statistics (significance, asymmetric errors , ul) for Poisson distributed variable with unknown background.
- Parameters
- n_onint
Measured counts in on region
- n_offint
Measured counts in off region
- alphafloat
Acceptance ratio of on and off measurements
- mu_sigfloat
Expected signal counts in on region
Attributes Summary
Approximate error from the covariance matrix.
Known background computed alpha * n_off
Excess
Return p_value of measured excess.
Return statistical significance of measured excess.
Stat value for best fit hypothesis, i.e.
Stat value for null hypothesis, i.e.
Return stat difference (TS) of measured excess versus no excess.
Methods Summary
compute_errn
([n_sigma])Compute downward excess uncertainties.
compute_errp
([n_sigma])Compute upward excess uncertainties.
compute_upper_limit
([n_sigma])Compute upper limit on the signal.
n_sig_matching_significance
(significance)Compute excess matching a given significance.
Attributes Documentation
-
error
¶ Approximate error from the covariance matrix.
-
n_bkg
¶ Known background computed alpha * n_off
-
n_sig
¶ Excess
-
p_value
¶ Return p_value of measured excess. Here the value accounts only for the positive excess significance (i.e. one-sided).
-
sqrt_ts
¶ Return statistical significance of measured excess. The sign of the excess is applied to distinguish positive and negative fluctuations.
-
stat_max
¶ Stat value for best fit hypothesis, i.e. expected signal mu = n_on - alpha * n_off - mu_sig
-
stat_null
¶ Stat value for null hypothesis, i.e. mu_sig expected signal counts
-
ts
¶ Return stat difference (TS) of measured excess versus no excess.
Methods Documentation
-
compute_errn
(n_sigma=1.0)¶ Compute downward excess uncertainties.
Searches the signal value for which the test statistics is n_sigma**2 away from the maximum.
- Parameters
- n_sigmafloat
Confidence level of the uncertainty expressed in number of sigma. Default is 1.
-
compute_errp
(n_sigma=1)¶ Compute upward excess uncertainties.
Searches the signal value for which the test statistics is n_sigma**2 away from the maximum.
- Parameters
- n_sigmafloat
Confidence level of the uncertainty expressed in number of sigma. Default is 1.
-
compute_upper_limit
(n_sigma=3)¶ Compute upper limit on the signal.
Searches the signal value for which the test statistics is n_sigma**2 away from the maximum or from 0 if the measured excess is negative.
- Parameters
- n_sigmafloat
Confidence level of the upper limit expressed in number of sigma. Default is 3.
-
n_sig_matching_significance
(significance)¶ Compute excess matching a given significance.
This function is the inverse of
significance
.- Parameters
- significancefloat
Significance
- Returns
- n_sig
numpy.ndarray
Excess
- n_sig