pbetaRv1 | R Documentation |
pbetaRv1()
is an implementation of the original
(“version 1” pbeta()
function in R (versions <=
2.2.x), before we started using TOMS 708 bratio()
instead, see
the current pbeta
help page also for references.
pbetaRv1()
is basically a manual translation from C to R of the
underlying pbeta_raw()
C function, see in R's source tree at
https://svn.r-project.org/R/branches/R-2-2-patches/src/nmath/pbeta.c
For consistency within R, we are using R's argument names
(q, shape1, shape2)
instead of C code's
(x, pin, qin )
.
It is only for the central beta distribution.
pbetaRv1(q, shape1, shape2, lower.tail = TRUE,
eps = 0.5 * .Machine$double.eps,
sml = .Machine$double.xmin,
verbose = 0)
q , shape1 , shape2 |
non-negative numbers, q in |
lower.tail |
indicating if |
eps |
the tolerance used to determine congerence. |
sml |
the smallest positive number on the typical platform. The
default |
verbose |
integer indicating the amount of verbosity of
diagnostic output, |
a number.
The C code contains
This routine is a translation into C of a Fortran subroutine
by W. Fullerton of Los Alamos Scientific Laboratory.
Martin Maechler
(From the C code:)
Nancy E. Bosten and E.L. Battiste (1974). Remark on Algorithm 179 (S14): Incomplete Beta Ratio. Communications of the ACM, 17(3), 156–7.
pbeta
.
all.equal(pbetaRv1(1/4, 2, 3),
pbeta (1/4, 2, 3))
set.seed(101)
N <- 1000
x <- sample.int(7, N, replace=TRUE) / 8
a <- rlnorm(N)
b <- 5*rlnorm(N)
pbt <- pbeta(x, a, b)
for(i in 1:N) {
stopifnot(all.equal(pbetaRv1(x[i], a[i], b[i]), pbt[i]))
cat(".", if(i %% 20 == 0) paste0(i, "\n"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.