Simple likelihood ratio test


I am trying to conduct a simple likelihood ratio test using RooStats and I have several questions.

  1. Is it possible to change the statistic formula from -log[L(null)/L(alt)] to -2*log[L(alt)/L(null)]? How can I do it?

  2. How setting up the initial values of my distribution affects my test statistic? e.g. declaring a variable x[150, 0,500] for my control region Poisson distribution will set up an observed number of events in my experiment to 150?

  3. What is the dependence of my test statistic from the prior I force on it? In my case I am trying to find the significance of discovery of signal in model with 100 b events and 50 s events. According to my calculation the highest significance is expected for the prior distribution in the control region with b = 100, but my program gives me the highest significance for b = 150.

4)Is it possible to configure the plot that I get using HypoTestPlot? I need to change axis caption and the color of the curves and area under the curves, how can I do it?

Sorry if these questions seem to be silly, I am new to RooFit and RooStats and I am trying to understand it.

Thank you very much in advance for replies!


  1. The change you request is a trivial one, you just need to multiply the obtained result by -2 and you obtain the test statistics you want. The test statistics distribution will then be the same.

  2. Declaring a variable x[150,0,500] will result in setting the value of x to 150. I don’t know which procedure you use to compute your test, so I don’t know what then is happening afterwards with the variable x. If you are doing an hypothesis tests from the test statistic distribution which you obtained using toys then the value of x will be sampled for every event

  3. I would need to understand better your model and the procedure you are using

  4. The HypotestPlot ( derived class of SamplingDistPlot) is drawn as a RooPlot. You can access the RooPlot object using the GetPlot() function, and from this you can apply all customisations which are available for a RooPlot class. For example from the RooPlot you can retrieve the histograms representing the test statistics distributions and change their line colour or the area under them.
    Some customisation are available in the SamplingDistPlot class (see the reference documentation.


Hello, Lorenzo!

Thank you!
I have some questions to your reply.

  1. You say that I can multiply my results by -2. Does it imply that in order to get the significance that I need, I simply multiply obtained significance by the factor -2?
  2. So every event for my test statistic will be generated with x = 150?
  3. Here I attach my code so you can better understand my procedure.

#Setup workspace for models

wspace = ROOT.RooWorkspace(“wspace”)

#Configure alternative (s+b) distribution

wspace.factory(“Poisson::px(x[150, 0,500], sum::splusb(s[0,50],b[100,0,150]))”)

#Configure prior distribution for background (tau*b)

wspace.factory(“Poisson::py(y[100,0,500], sum::taub(tau[1.],b))”)


#Define observables, parameters of interest and nuisance parameters

wspace.defineSet(“obs”, “x”)

wspace.defineSet(“poi”, “s”)

wspace.defineSet(“nui”, “b”)

#Create toy dataset with x=60
data = ROOT.RooDataSet(“d”, “d”, wspace.set(“obs”))


#Construct and configure alternative and null models

#Null(background only model)

b_model = ROOT.RooStats.ModelConfig(“B_model”, wspace)






#Alternative(signal + background model)

sb_model = ROOT.RooStats.ModelConfig(“S+B_model”, wspace)






#Define test statistic that is going to be used for testing the hypothesis

teststat = ROOT.RooStats.SimpleLikelihoodRatioTestStat(sb_model.GetPdf(), b_model.GetPdf())



#Construct hypothesis test

hc2 = ROOT.RooStats.HybridCalculator(data, b_model, sb_model)

toymcs2 = hc2.GetTestStatSampler()



hc2.SetToys(20000, 20000)



#Print the results

r2 = hc2.GetHypoTest()



#Draw the plot

c1 = ROOT.gROOT.Get(“c1”)

if not c1:

c1 = ROOT.TCanvas(“c1”)

p2 = ROOT.RooStats.HypoTestPlot(r2, 1000)



I use simple likelihood ratio test for alternative (s+b) hypothesis against null (only b) hypothesis. In order to conduct such a procedure I use HybridCalculator and SimpleLikelihoodTestStat.

Thank you in advance!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.