Skip to content
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

jackknifeVarianceUnb fails for input of length 2 #140

Closed
patrickdoc opened this issue Jan 17, 2018 · 2 comments
Closed

jackknifeVarianceUnb fails for input of length 2 #140

patrickdoc opened this issue Jan 17, 2018 · 2 comments

Comments

@patrickdoc
Copy link

While investigating Criterion issue #162, I've uncovered an problem with the jackknife calculations.

https://github.com/bos/statistics/blob/98a5e888ab411b3f48d31bb677b4c8f1db880217/Statistics/Resampling.hs#L223-L245

When the input is of length 2, q is 1. For jackknifeVarianceUnb, c will also be 1. This means that at the very least, go will divide everything by 0.

Additionally, if my algebra skills haven't failed me, al + ar - (b * b) will always be 0, so go is just (0/1)/0 = NaN for both elements of the sample.

@Shimuuar
Copy link
Collaborator

Thank you! jackknife works by throwing out every other sample and if sample have two elements jackknife will try to estimate variance for two one-element sample and will fail.

I'll add call to error for 2-element sample and variance/standard deviation. But it's part of more general problem (#100)

@Shimuuar
Copy link
Collaborator

fixed in d842eb7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants