-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af0f2bb
commit d46d120
Showing
13 changed files
with
530 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
Package: BlakerCI | ||
Type: Package | ||
Title: Blaker's binomial confidence limits | ||
Version: 1.0-4 | ||
Date: 2014-05-07 | ||
Title: Blaker's Binomial Confidence Limits | ||
Version: 1.0-5 | ||
Date: 2015-08-20 | ||
Author: Jan Klaschka | ||
Maintainer: Jan Klaschka <klaschka@cs.cas.cz> | ||
Description: Fast and accurate calculation of | ||
Blaker's binomial confidence limits | ||
(and some related stuff) | ||
License: GPL-2 | ||
Description: Fast and accurate calculation of Blaker's binomial confidence limits (and some related stuff). | ||
License: GPL-3 | ||
LazyLoad: yes | ||
Packaged: 2014-05-06 19:54:43 UTC; klaschka | ||
NeedsCompilation: no | ||
Packaged: 2015-08-20 15:45:10 UTC; klaschka | ||
Repository: CRAN | ||
Date/Publication: 2014-05-07 23:35:18 | ||
Date/Publication: 2015-08-20 19:52:46 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
eeeb878922147817fc8fd6028f2cf6f9 *ChangeLog | ||
a73e4e800296623ff377abfd0438bcba *DESCRIPTION | ||
76b309ced09fde087399bf426fe6bbaa *NAMESPACE | ||
9677a0469d8f43c4c0bda58d24473b77 *ChangeLog | ||
aeff792d2d47edf07c21f9f1f67a3a86 *DESCRIPTION | ||
622d97f1a2f90799930a4cd04c5a3258 *NAMESPACE | ||
8f41fbda3173ebf87f028f2479cbd70b *R/binom.blaker.VHadj.acc.R | ||
7bd74de7a2337bd2e96a08a9ba3f7c94 *R/binom.blaker.VHadj.limits.R | ||
b81d0a0e4af032ee3c7a781fcce33e29 *R/binom.blaker.VHadj.lower.limit.R | ||
38f9b537d00dba55ae6a2717721bdbdd *R/binom.blaker.acc.R | ||
e31a8b5ad8ee890e82fa31bc5777b9f4 *R/binom.blaker.acc.single.p.R | ||
cfa0c40d1cbd95045c3400212df7a4d6 *R/binom.blaker.limits.R | ||
83a0de528aa33eb2acae2965b561638b *R/binom.blaker.lower.limit.R | ||
afd954c6de1e31cad77d458048675f81 *man/BlakerCI-internal.Rd | ||
f9d6fb28066f558da9f6a32c779c3e29 *man/BlakerCI-package.Rd | ||
ed48c280ca2556fcbb9e607e263c0985 *man/binom.blaker.acc.Rd | ||
db02a5c5631ff08520055cf56e1dfd95 *man/binom.blaker.limits.Rd | ||
f65871c4eefefd0a087c3baed147f43d *man/BlakerCI-internal.Rd | ||
dc046f448f61ede62eb7e81f31ac9965 *man/BlakerCI-package.Rd | ||
c7739d5ea97fd342138aa25528d5dc4f *man/binom.blaker.VHadj.acc.Rd | ||
158ec2cc80c7eccf4fb4209e7726b8a2 *man/binom.blaker.VHadj.limits.Rd | ||
f1a7c77709703911bc5b6306381576d0 *man/binom.blaker.acc.Rd | ||
0b2164dd6cd538fc2278ca83bb9ce32f *man/binom.blaker.limits.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export(binom.blaker.lower.limit,binom.blaker.limits,binom.blaker.acc.single.p,binom.blaker.acc) | ||
importFrom("stats", "pbinom", "qbinom", "qbeta", "pbeta") | ||
export(binom.blaker.lower.limit,binom.blaker.limits,binom.blaker.acc.single.p,binom.blaker.acc, | ||
binom.blaker.VHadj.lower.limit,binom.blaker.VHadj.limits,binom.blaker.VHadj.acc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
binom.blaker.VHadj.acc <- function(x,n,p,type=c("orig","unimod"),acc.tol=1e-10,nmax=n+1000,int.eps=1e-12,...) { | ||
if (n < 1 || x < 0 || x > n) stop("Parameters n = ",n,", x = ",x, " wrong!") | ||
if (acc.tol <= 0) stop("Numerical tolerance ",acc.tol," nonpositive!") | ||
type <- match.arg(type) | ||
if (type != "orig" && type != "unimod") stop("Unknown type ",type,"!") | ||
m <- length(p) | ||
if (m < 1) stop("Empty vector p!") | ||
acc <- binom.blaker.acc(x,n,p,type=type,acc.tol=acc.tol,...=...) | ||
nn <- n+1 | ||
ind.susp <- 1:length(p) | ||
ind.susp1 <- ind.susp[p[ind.susp] <= x/n] | ||
ind.susp2 <- ind.susp[p[ind.susp] > x/n] | ||
repeat { | ||
if (nn > nmax) { | ||
warning("n = ", n, ", x = ", x,": Upper limit of ", nmax, | ||
" too low, Vos-Hudson adjustment may be incomplete.") | ||
break | ||
} | ||
xx <- x*nn/n | ||
aa1 <- pmin(2*pbeta(p[ind.susp1],xx,nn-xx+1),1) | ||
aa2 <- pmin(2*pbeta(1-p[ind.susp2],nn-xx,xx+1),1) | ||
ind.susp1 <- ind.susp1[aa1 > acc[ind.susp1]] | ||
ind.susp2 <- ind.susp2[aa2 > acc[ind.susp2]] | ||
if (length(ind.susp1) + length(ind.susp2) < 1) break | ||
acc.nn.L <- numeric(0) | ||
acc.nn.R <- numeric(0) | ||
if (length(ind.susp1) > 0) { | ||
x.star <- ceiling(xx-int.eps) | ||
acc.nn.L <- binom.blaker.acc(x.star,nn,p[ind.susp1],type=type,acc.tol=acc.tol,...=...) | ||
} | ||
if (length(ind.susp2) > 0) { | ||
x.star <- floor(xx+int.eps) | ||
acc.nn.R <- binom.blaker.acc(x.star,nn,p[ind.susp2],type=type,acc.tol=acc.tol,...=...) | ||
} | ||
acc.nn <- c(acc.nn.L,acc.nn.R) | ||
ind.susp <- c(ind.susp1,ind.susp2) | ||
acc[ind.susp] <- pmax(acc[ind.susp],acc.nn) | ||
nn <- nn+1 | ||
} | ||
|
||
acc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
binom.blaker.VHadj.limits <- function(x,n,level=.95,tol=1e-10,...) { | ||
if (n < 1 || x < 0 || x > n) stop("Parameters n = ",n,", x = ",x, " wrong!") | ||
if (level <= 0 || level >= 1) stop("Confidence level ",level," out of (0, 1)!") | ||
if (tol <= 0) stop("Numerical tolerance ",tol," nonpositive!") | ||
lower <- binom.blaker.VHadj.lower.limit(x,n,level,tol,...) | ||
upper <- 1 - binom.blaker.VHadj.lower.limit(n-x,n,level,tol,...) | ||
return(c(lower,upper)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
binom.blaker.VHadj.lower.limit <- function(x,n,level,tol=1e-10,maxiter=100,nmax=n+1000,int.eps=1e-10) { | ||
if (x <=0) return(0) | ||
if (x>0) { | ||
lower <- binom.blaker.lower.limit(x,n,level,tol,maxiter) | ||
alpha <- 1-level | ||
nn <- n | ||
p <- x/n | ||
repeat { | ||
nn <- nn+1 | ||
xstar <- nn*p | ||
if (qbeta(alpha/2,xstar,nn-xstar+1) > lower) break | ||
if (nn > nmax) { | ||
warning("n = ", n, ", x = ", x,": Upper limit of ", nmax, | ||
" too low, Vos-Hudson adjustment may be incomplete.") | ||
break | ||
} | ||
xx <- ceiling(xstar-int.eps) | ||
ll <- binom.blaker.lower.limit(xx,nn,level,tol,maxiter) | ||
lower <- min(lower,ll) | ||
} | ||
} | ||
return(lower) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.