How to add penalty to likelihood and use RooStats

Dear expert,

it is quite easy to add penalty to the likelihood as:

RooNLLVar nll("nll","nll",f,*d) ;
RooRealVar alpha("alpha","penalty strength",1000) ;
RooFormulaVar nllPen("nllPen",
		       "nll+alpha"
		       RooArgList(nll,alpha)) ;
  
  RooMinuit m(nllPen) ;

The problem is that I end with a likelihood, while all the RooStats class takes as input a workspace with a pdf and data. How to use RooStats utilities as ProfileLikelihoodCalculator with likelihood with penalty?

Is there a a way for example to save the penalty inside the model config?

Hi,
You can save the penalty term in a RooWorkspace as a RooAbsReal object for example, but it is true unfortunatly we dont have the support for a customised likelihood in RooStats.
If you can include the penalty term as an extra pdf components, which will be added automatically to the log-likelihood, then it possible to include it.
Otherwise, what you could do is to create yourself the test statistics by extending the ProfileLikelihoodtestStat and re-impelmenting the evaluation using the modified likelihood.
In this way the penalty term will be used in the test statistics. However, it will not be used for example in the best fits which are performed for example by the FrequentistCalculator to find the conditional values of the nuisance parameters used to generate the toys.

Best Regards

Lorenzo