Calculation of errors on RooFormulaVar

Hi all,

Is there any already coded method to calculate the errors on formulas ? I could do it by hand, but I just wanted to know if there is any already existing method.

Thanks a lot.

Hi Aurelien,

If f(x,y) is a RooFormulaVar and (x,y) are parameters fitted you can propagate
the errors as follows if you have the RooFitResult of the fit that gave you (x,y)

// Inputs
RooFormulaVar* f ;
RooFitResult* r ;

TH1D* h_f(“h_f”,“h_f”,100,x,y) ; // choose reasonable range here
RooArgSet* f_vars = f->getVariables() ;
for (i=0 ; i<1000 ; i++) {
*f_vars = f->randomizePars() ;
h_f->Fill(f->getVal()) ;
cout << "error on f is " << h_f->GetRMS() ;

The correlations between in the input variables are taken from the fit result.


PS: In the next ROOT version (5.25.01) a simpler linear error propagation tool will be available (RooAbsReal::getPropagatedError(const RooFitResult&r)). The math for that is
already implemented for the new VisualizeError() option of RooAbsReal::plotOn(),
it just did not get around to interfacing this for standalone error propagation yet.


The RooAbsReal::getPropagatedError() is already available in the
dev/roostats of the ROOT SVN repository.

With that you can simply do

Double_t funcError = func.getPropagatedError(fitResult) ;

to calculate the propagated error.


1 Like

Many thanks Wouter !