picexp function

The Piecewise Exponential Distribution

The Piecewise Exponential Distribution

Density, distribution function, quantile function, hazard function h(t), cumulative hazard function H(t), and random generation for the piecewise exponential distribution with rate equal to 'rate' and cut points equal to 'cuts'.

dpicexp(x, rate=1, cuts=c(0, 10), log = FALSE) ppicexp(q, rate=1, cuts=c(0, 10), lower.tail = TRUE, index = NULL) qpicexp(p, rate=1, cuts=c(0, 10), lower.tail = TRUE) rpicexp(n, rate=1, cuts=c(0, 10)) hpicexp(x, rate, cuts, index=NULL) Hpicexp(x, rate, cuts, index=NULL) # ## to fit a piece exponential survival model use: # # picfit(y, cuts=c(0, 10)) #

Arguments

  • x, q: vector of quantiles.
  • p: vector of probabilities.
  • n: number of observations. If 'length(n) > 1', the length is taken to be the number required.
  • rate: vector rate parameter, defaulting to 1.
  • cuts: cut points, defaulting 0 to 10.
  • log: logical; if TRUE, probability p are given as log(p).
  • lower.tail: logical; if TRUE(default), probabilities are P[X <= x], otherwise, P[X>x].
  • index: index of x, q in the interval defined by cuts, it saves time if index is known.

Details

If the rate is not specified, it assumes the default value of 1.

Returns

dpicexp gives the density, ppicexp gives the distribution function, qpicexp gives the quantile function, and rpicexp generates random deviates.

The length of the result is determined by n for rpicexp.

Only the first elements of the logical arguments are used.

References

Chen, B. E., Cook, R. J., Lawless, J. F. and Zhan, M. (2005). Statistical methods for multivariate interval-censored recurrent events. Statistics in Medicine. Vol 24, 671-691.

Author(s)

Bingshu E. Chen (bingshu.chen@queensu.ca)

Note

The cumulative hazard H(t) = -log(1-F(t)) is log(1-ppicexp(t, rate, cuts)), or more efficiently call function Hpicexp(t, rate, cuts).

See Also

exp for the exponential function.

Distributions for other standard distributions, including dgamma for the gamma distribution and dweibull for the Weibull distribution.

Examples

## ### No run # n = 100 # rate = c(1, 1, 0.5, 0.125) # cuts = c(0, 1, 2.5, 5, 10) # x = rpicexp(n, rate, cuts) # ### compare rexp and rpicexp # #print(ppicexp(2.5, rate = .5)) #print(pexp(2.5, rate = 0.5)) # #
  • Maintainer: Bingshu E. Chen
  • License: GPL (>= 2)
  • Last published: 2022-08-31

Useful links