Learn R Programming

PWEALL (version 1.3.0.1)

pwe: Piecewise exponential distribution: hazard, cumulative hazard, density, distribution, survival

Description

This will provide the related functions of the specified piecewise exponential distribution.

Usage

pwe(t=seq(0,5,by=0.5),rate=c(0,5,0.8),tchange=c(0,3))

Value

hazard

Hazard function

cumhazard

Cumulative hazard function

density

Density function

dist

Distribution function

surv

Survival function

Arguments

t

A vector of time points.

rate

A vector of event rates

tchange

A strictly increasing sequence of time points at which the event rate changes. The first element of tchange must be zero. It must have the same length as rate.

Author

Xiaodong Luo

Details

Let \(\lambda(t)=\sum_{j=1}^m \lambda_j I(t_{j-1}\le t<t_j)\) be the hazard function, where \(\lambda_1,\ldots,\lambda_m\) are the corresponding elements of rate and \(t_0,\ldots,t_{m-1}\) are the corresponding elements of tchange, \(t_m=\infty\). The cumulative hazard function $$\Lambda(t)=\sum_{j=1}^m \lambda_j(t\wedge t_j-t\wedge t_{j-1}),$$ the survival function \(S(t)=\exp\{-\Lambda(t)\}\), the distribution function \(F(t)=1-S(t)\) and the density function \(f(t)=\lambda(t)S(t)\).

References

Luo, et al. (2017)

See Also

rpwe,qpwe

Examples

Run this code
t<-seq(0,3,by=0.1)
rate<-c(0.6,0.3)
tchange<-c(0,1.75)
pwefun<-pwe(t=t,rate=rate,tchange=tchange)
pwefun

Run the code above in your browser using DataLab