Integrating under a range of PDF

Dear Experts,
I have a simple PDF over X variable:

pdf = fR . signalPdf(X) + (1-fR) . bkgPdf(X)

I am fitting it and getting a fraction over full X-range. Is there a way in which I can get the fraction over a specified X range (e.g. 3.0-6.0). It is easier to do if I have functional integral over total function (pdf) and bkg function (bkgPdf), but here with pdf I am not sure.

However, I can use createIntegral() function, which already gives me:

X.setRange(“sigRange”,3.0,6.0)
bkg.createIntegral(X,NormSet(X),Range(“sigRange”)) = p ;
pdf.createIntegral(X,NormSet(X),Range(“sigRange”)) = q ;

But here I don’t if I can directly use the p & q fractions to compute fR(3.0 - 6.0). Please suggest if you have clear ideas to make it.

Thank you in advance!

Hi @hym!

Indeed, you were right to be careful with your p and q integrals. Keep in mind that p is not the integral of the background component in the pdf, but the integral of the normalized background pdf in the sigRange.

Hence, if you want to get background integral in the signal range, you have to scale p by the background fraction in the total range which is (1 - fR).

Put into a formula, here is how I think you can calculate the signal fraction fR_signalRange:

1 - fR_signalRange = (1 - fR) * (p / q)

You could have it even easier if you use the intagrals of sig and pdf, so you don’t need the (1 - ...).

I would implement that and also fit fR_signalRange directly by fitting only the signalRange as a cross check.

Let me know if this gives you the correct result and if you have further question!

Jonas

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