Skip to content

fixed the beta method in proportion_confint for 2 corner cases - #2789

Closed
ngaurav wants to merge 2 commits into
statsmodels:masterfrom
ngaurav:2742_confinterval
Closed

ngaurav wants to merge 2 commits into
statsmodels:masterfrom
ngaurav:2742_confinterval

Conversation

@ngaurav

@ngaurav ngaurav commented Jan 30, 2016

Copy link
Copy Markdown

Compared count and nobs. Earlier the 2 cases were showing NaN. Fixes #2742
Logic:
(i) if count = 0, ci_low = 0.
(ii) if count = nobs, ci_high = 1.

@josef-pkt

Copy link
Copy Markdown
Member

see the test error on TravisCI.
This needs to be able to work vectorized.

@josef-pkt

Copy link
Copy Markdown
Member

The problem is the equality condition which doesn't return a scalar bool.

@ngaurav

ngaurav commented Jan 31, 2016

Copy link
Copy Markdown
Author

I have used nan_to_num() which simply replaces each occurrence of NaN by 0. This is what we expect in ci_low. I have assumed that ci_upp never becomes 0 and therefore I replace NaN by 0(using nan_to_num) then 0 by 1. The other assumption is that in 'beta' method, NaN occurs in ci_low only when count is 0; and NaN occurs in ci_upp only when count == nobs.

@josef-pkt

Copy link
Copy Markdown
Member

closing, fixed by #4410

@josef-pkt josef-pkt closed this Mar 30, 2018
@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Jul 27, 2020
@josef-pkt josef-pkt added superseded Used for PRs with content that is superseded by a newer PR and removed rejected Used for PRs with changes that are not acceptable labels Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

superseded Used for PRs with content that is superseded by a newer PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: proportion confint returns nan, negative and larger than 1

4 participants