Dear Experts,
I’m trying to cross-check the result I get from HypoTestInverter
with a 95% confidence interval. To do this, I am scanning over different significances for different values of the POI from HypoTestResult::Significance()
until this goes over 1.64 (the standard deviation of a 5% single-sided Gaussian tail). I get different results from both of these, am I misunderstanding something?
(I’ve read through the code of HypoTestInverterResult
and HypoTestInverter
, which scan over pValue instead of significance, but I don’t see where the difference comes from)
I’ve attached a standalone script (demoSignificanceVsInverter.py (3.8 KB)). The key parts of this script are:
Strategy 1 (Using HypoTestResult::Significance())
# scan over values of mu until signifigance above 95% one-sided threshold
threshold = 1.64
for mu in np.arange(100,130,1):
# set up model config
h1_model = ModelConfig("h1",w)
h1_model.SetPdf(w.pdf("model"))
w.var("mu").setVal(mu)
h1_model.SetObservables(RooArgSet(w.var("x")))
h1_model.SetParametersOfInterest(w.set("poi"))
h1_model.SetNuisanceParameters(w.set("nuis"))
h1_model.SetSnapshot(w.set("poi"))
# set up calculator
ac = AsymptoticCalculator(data, h0_model, h1_model); # wrong order (for limits)
ac.SetOneSided(True);
result = ac.GetHypoTest()
# if signifigance is higher, stop
if result.Significance()>threshold:
strategyResult1 = mu
Strategy 2 (using HypoTestInverter)
# set up calculator
ac = AsymptoticCalculator(data, h0_model, h1_model); # wrong order (for limits)
ac.SetOneSided(True);
calc = HypoTestInverter(ac);
calc.SetFixedScan(100,0,200, False)
calc.UseCLs(True)
calc.SetConfidenceLevel(0.95);
result = calc.GetInterval()
strategyResult2 = result.GetExpectedUpperLimit(0)
The issue is that strategyResult1
and strategyResult2
don’t agree:
==================================================
Limit on 'mu' from Strategy 1: 129
Limit on 'mu' from Strategy 2: 104.042149599
==================================================
Thanks for any insight about this difference.
Aaron