PExp {peppm} | R Documentation |
Probability function, distribution function, quantile function and random generation for the Piecewise Exponential (PE) distribution.
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)
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. |
dpexp gives the (log) probability function, ppexp gives the (log) distribution function, qpexp gives the quantile function, and rpexp generates random deviates.
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