R: 'pbeta()' 'bpser' series computation

bpser {DPQ} | R Documentation

## `pbeta()` 'bpser' series computation

### Description

Compute the `bpser` series approximation of `pbeta`, the incomplete beta function. Note that when `b` is integer valued, the series is a sum of b+1 terms.

### Usage

    bpser(a, b, x, log.p = FALSE, eps = 1e-15, verbose = FALSE, warn = TRUE)

### Arguments

`a,b` | numeric and non-negative, the two shape parameters of the beta distribution.
`x` | numeric vector of abscissa values in [0,1].
`log.p` | a `logical` if `log(prob)` should be returned, allowing to avoid underflow much farther “out in the tails”.
`eps` | series convergence (and other) tolerance, a small positive number.
`verbose` | a `logical` indicating if some intermediate results should be printed to the console.
`warn` | a `logical` indicating if `bpser()` computation problems should be warned about in addition to return a non-zero error code.

### Value

a `list` with components

`r` | the resulting `numeric` vector.
`ier` | an integer vector of the same length as `x`, providing one error code for the computation in each `r[i]`.

### Author(s)

Martin Maechler, ported to DPQ; R-Core team for the code in R.

### References

TOMS 708, see `pbeta`

### See Also

`pbeta`.

### Examples

    with(bpser(100000, 11, (0:64)/64), # all 0 {last one "wrongly"}
         stopifnot(r == c(rep(0, 64), 1), err == 0))
    bp1e5.11L <- bpser(100000, 11, (0:64)/64, log.p=TRUE)# -> 2 "underflow to -Inf" warnings!
    pbe <- pbeta((0:64)/64, 100000, 11, log.p=TRUE)

    ## verbose=TRUE showing info on number of terms / iterations
    ps11.5 <- bpser(100000, 11.5, (0:64)/64, log.p=TRUE, verbose=TRUE)

[Package DPQ version 0.5-2 Index]