-
Notifications
You must be signed in to change notification settings - Fork 133
Add normal interval to plotratio #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add normal interval to plotratio #182
Conversation
|
Please fix flake8 violations: |
|
Since the error on an efficiency is derived from two correlated numbers, when the numerator and denominator are equal their variations are 100% correlated and of the same size and so the statistical error on an efficiency value of 1 is zero. This is manifestly undercovering and there are a ton of recipes for getting good coverage and the tradeoffs between them. Typically Clopper-Pearson is favored, but having other implementations of efficiency errors is welcome. |
|
Please add a test for this new function. |
|
So, of course clopper-pearson is already available. |
|
My understanding was that Clopper-Pearson is not valid for non-integer num/denoms. I think what you're describing is basically what is happening there. The reason I link to the ROOT code is that that's literally where I have the algorithm from, and I think it makes sense to disclose that. I can certainly add the wikipedia link you provided as well, but I'd prefer keeping the other URL in there as well. |
|
Ah yeah, fair enough, this would be needed for efficiencies derived from weighted data (which is kind of rare, but definitely happens). |
|
Well I have this specific case right now, that's why I thought of adding it 😄 |
|
Ah, nevermind, this is just the result of expanding eff = p/(p+f) in partial derivatives of p and f. |
|
I think we should go ahead with this PR. @paulgessinger can you fix the flake8 complaints? |
|
Will do. |
|
@paulgessinger can you please add a test for: |
|
I'm working on it. |
|
Flake8 should be fixed, I added a test that compares against test output I got from TEfficiency. The test also covers edge cases like |
|
Looks good, thank you! |
|
I added a docstring to the function after the fact. |
|
Yeah looks good I think. |
I was thinking about adding the efficiency error calculation as is implemented in TEfficiency. Before I write comments and/or tests, I wanted to ask/discuss if this makes sense, since there is already the num method.
One thing I noticed with the way the errors are calculated (see https://root.cern.ch/doc/master/TEfficiency_8cxx_source.html#l02515 and below) is that if
num==denomthen the error will be 0. Does that even make sense? Technically,scipy.stats.norm.ppfcomplains if it is called withsigma = 0, so I'm masking out zero elements and manually set those to zero errors.Thoughts?