# DMelt:Statistics/4 Statistical Limits

# Statistical limits

Here we will shows a few examples of how to set statistical limits.

Let us build 2 experiments with observed data, and calculate probability for the given limit. The user can iterate towards whatever limit type they choose, e.g., for a 90% upper limit they adjust the limit guess until the probability is shown as 0.10; for a 90% lower limit they would aim for 0.90.

Protected code example! Request membership or login to this member link first. |

The output is:

```
Get probabilities for lower limits:
Prob (Cousins+Highland)= 0.6716
Prob (BaBar SWG)= 0.6719
Prob (Jeffreys)= 0.6671
```

# Signal exclusion limits on a smooth background

This program demonstrates the computation of 95 % C.L. limits with correct treatment of statistical errors. Signal hypothesis is excluded at the 95% CL if CLs = 0.05 and at more than the 95% CL if CLs < 0.05, assuming that signal is present.

This algorithm uses the Likelihood ratio semi-Bayesian method. This method is described in this paper (PDF). It takes signal, background and data histograms and runs a set of Monte Carlo experiments (>50000 in this example ) in order to compute the limits.

Let's give some definitions: [math]CL_{s+b} =P_{s+b} (X \lt X_{obs})[/math] is the confidence level for excluding the possibility of simultaneous presence of new particle production and background (the s + b hypothesis). This corresponds to the probability that the test statistic would be less than or equal to that observed in the data, assuming the presence of both signal and background at their hypothesized levels.

The confidence level [math](1-CL_{s+b})[/math] may be used to quote exclusion limits although it has the disturbing property that if too few candidates are ob- served to account for the estimated background, then any signal, and even the background itself, may be excluded at a high confidence level. [math]CL_{b} =P_{b} (X \lt X_{obs})[/math] is the confidence level for the background alone. It expresses the probability that background processes would give fewer than or equal to the number of candidates observed. Then [math]1-CL_{b}[/math] gives the probability that the background could have fluctuated to produce a distribution of candidates at least as signal-like as those observed in the data. [math]CL_{s} = CL_{s+b}/CL_{b}[/math] is the Modified Frequentist confidence level. It is used to calculate 95% CL upper limits (CLs less than 0.05) on the signal

Furthermore, the PDFs of X in the signal+background and background hypotheses allow computation of the expected confidence levels <CLs+b>, <CLb>, and <CLs>, assuming the presence only of background. These are indications of how well an experiment would do on average in excluding a signal if the signal truly is not present, and are the important figures of merit when optimizing an analysis for exclusion.

Protected code example! Request membership or login to this member link first. |

The output is:

```
CLs : 0.00129900435575
CLb : 0.07939
CLsb : 0.000103127955803
expected <CLs> : 0.018271281974
expected <CLb> : 0.50001
expected <CLsb> : 0.50001
Signal hypothesis is excluded at level (%) 99.8700995644
```

You can find more example illustrating how to set limits and exclusion limits using DMelt examples |

More information on this topic is in DMelt books |