PExp: Probability function, distribution function, quantile...

Description Usage Arguments Value Examples

Description

Probability function, distribution function, quantile function and random generation for the Piecewise Exponential (PE) distribution.

Usage

1
2
3
4
5
6
7
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[X ≤ x]; otherwise, P[X > x].

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

1
2
3
4
5
6
7
8
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

fndemarqui/peppm documentation built on June 29, 2020, 2:08 a.m.