PExp {peppm} | R Documentation |
Probability function, distribution function, quantile function and random generation for the Piecewise Exponential (PE) distribution.
Description
Probability function, distribution function, quantile function and random generation for the Piecewise Exponential (PE) distribution.
Usage
dpexp(x, tgrid, rates, log = FALSE)
ppexp(q, tgrid, rates, lower.tail = TRUE, log.p = FALSE)
qpexp(p, tgrid, rates, lower.tail = TRUE, log.p = FALSE)
rpexp(n, tgrid, rates)
Arguments
x |
vector of time points. |
tgrid |
vector of time grid knots. |
rates |
vector of failure rates. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
q |
vector of quantiles. |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of random values to return. |
Value
dpexp gives the (log) probability function, ppexp gives the (log) distribution function, qpexp gives the quantile function, and rpexp generates random deviates.
Examples
n <- 10
tgrid <- c(0, 1, 3, 7, Inf)
rates <- c(0.5, 4, 0.8, 0.1)
x <- sort(rpexp(n, tgrid=tgrid, rates=rates))
Fx <- ppexp(x, tgrid, rates)
y <- qpexp(Fx, tgrid, rates)
# checking:
x==y
[Package peppm version 0.0.1 Index]