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

BUG: Change (n+1) to n for correct jackknife calculation of hd quantile standard error #16481

Merged
merged 3 commits into from Jun 29, 2022

Conversation

SamGRosen
Copy link
Contributor

@SamGRosen SamGRosen commented Jun 28, 2022

Reference issue

N/A

What does this implement/fix?

In Harrell and Davis' original paper (Formula 4), the standard error calculation for the quantiles is a jackknife estimator. A jackknife estimator requires calculating the estimator in a leave-one-out fashion; however, the current implementation uses (n+1) when calculating the weights used in the jackknife, when it should use n, as the jackknife leaves 1 data point out.

Appropriate unit tests updated. Changes include testing against the new correct values, and doing a rudimentary jackknife calculation to compare to the actual method.

Additional information

Funny enough, Harrell actually makes the same mistake in his implementation, which I'm guessing was used to verify correctness of the previous one.

@mdhaber
Copy link
Contributor

mdhaber commented Jun 29, 2022

Thanks @SamGRosen. The correction looks right to me. I've suggested a refactoring of your test in SamGRosen#1. If you agree with and merge that, I think this is good to go.

TST: mstsats.hdquantiles_sd: refactor test per Efron
@SamGRosen
Copy link
Contributor Author

@mdhaber LGTM! Done.

@mdhaber
Copy link
Contributor

mdhaber commented Jun 29, 2022

Thanks @SamGRosen!

@mdhaber mdhaber merged commit 535fea2 into scipy:main Jun 29, 2022
Giodiro pushed a commit to Giodiro/scipy that referenced this pull request Jun 29, 2022
…le standard error (scipy#16481)

* BUG: FChange (n+1) to n for correct jackknife calculation of hd quantile standard error

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
@mdhaber mdhaber added this to the 1.10.0 milestone Nov 29, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants