-
Notifications
You must be signed in to change notification settings - Fork 2
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
Question re: Implementation of clopper pearson in this package. #21
Comments
Thanks a lot for bringing up the matter and for going into this level of detail. Let me look into the matter. |
Again many thanks for the report here. The problem is now fixed on my local development version and a fix (as you suggest) will be included in the next release early 2025. I leave the issue open until the release is out. |
The upcoming # install.packages("remotes") # needed if package remotes is not available
# grabs current draft of the upcoming 1.8-0 release
remotes::install_github("weberse2/RBesT", ref="issue-prep-1-8-0-release") |
Thanks so much. I will update CAMIS repo to say that the issue was fixed in version 1.8-0 onwards. 😁 |
Closing with CRAN 1.8-0 release. |
Hi,
We were looking into why RBesT CI's for proportions using Clopper-Pearson method doesn't give an exact match to the Hmisc package. We discovered that you are using a slightly different formulae as hopefully we've described here correctly. https://psiaims.github.io/CAMIS/R/ci_for_prop.html. Is this method supported anywhere by published methods ? Could you give rationale as to why you implemented it this way?
Here is how we expalined what you've done, but please do let me know if it's incorrect. Thanks !
The {RBesT} package produces CIs using the Clopper-Pearson method. In this example (x=36 and n=154), the results match the cardx package. However, as described below, there are 2 cases where the results using RBesT package do not match cardx or Hmisc.
x = 0 (0% responders), in which case the lower limit does not match.
x = n (100% responders), in which case the upper limit does not match.
Because of the relationship between the binomial distirbution and the beta distribution. This package uses quantiles of the beta distribution to derive exact confidence intervals.
RBesT equations are:
pLow <- qbeta(Low, r + (r == 0), n - r + 1)
pHigh <- qbeta(High, r + 1, n - r + ((n - r) == 0))
If the equations were updated as follows then it would match Hmisc intervals:
pLow <- qbeta(Low, r, n - r + 1)
pHigh <- qbeta(High, r + 1, n - r)
The text was updated successfully, but these errors were encountered: