hazard {convexHaz} | R Documentation |
Create a hazard function (and its integral) given its support and mixing measure.
h(tt, supp, hpar) H(tt, supp, hpar)
tt |
real positive number. |
supp |
list containing the values in the support: e.g. list(constant = 0, tau = c(0.5), eta = c(1,2)) . |
hpar |
list containing the values in the mixing measure: e.g. list(alpha = numeric(), nu = c(3), mu = c(2,0.5)) . |
The functions convexMLE
and convexLSE
, as well as srMLE
and srLSE
return the MLE/LSE in terms of the support and mixture of the hazard function. The function h
translates these into a hazard function, and the function H
gives the cumulative hazard function (integral of h
).
Any convex hazard function can be written as a mixture of three types of basis functions: a constant function e(t)=1
, decreasing elbow fuctions e(t)=max(tau-t,0)
, and increasing elbow functions e(t)=max(t-eta,0)
. If the minimum of the hazard is located at a point a
, then the possible values of tau lie in the set [0,a]
and the possible values of eta must be greater than a
. We call the point a
the antimode. supp
describes the list of basis functions to use: if constant is 0 then there is no constant function, and tau
and eta
list the values of tau and eta used, respectively. hpar
describes the mixing weights associated to these functions, with alpha
giving the weight of the constant, and nu
and mu
giving the weights of tau and eta, respectively. Note that the weights need not total to one, and that for a discrete mixture the hazard rate will be a piecewise constant function.
For example, if supp=list(constant=1, tau=c(0.5), eta=numeric())
and
hpar=list(constant=3, nu=c(2), mu=numeric())
, then the hazard function is
h(t)=3*1+2*max(0.5-t,0)
.
value of the hazard or cumulative hazard function at (time) t.
Hanna Jankowski: hkj@mathstat.yorku.ca
Jankowski and Wellner (2007). Nonparametric estimation of a convex bathtub-shaped hazard function. Technical Report 521, Department of Statistics, University of Washington.
Jankowski and Wellner (2008). Computation of nonparametric convex hazard estimators via profile methods. Technical Report 542, Department of Statistics, University of Washington.
convexLSE
convexMLE
srLSE
srMLE
# Generate sample data: set.seed(1111, kind="default") x <- rweibull(50, 3) # Find the LSE with antimode a=0 over the range [0,1]: TT <- 1 lse <- srLSE(x, a=0, TT=TT) # create simpler function to evaluate hazard and cumulative hazard h.lse <- function(t){ return(h(t, lse$lse$supp, lse$lse$mix))} H.lse <- function(t){ return(H(t, lse$lse$supp, lse$lse$mix))} # hazard function at t=0 h.lse(0) # cumulative hazard function at t=1 H.lse(1) # plot the hazard function h.lse tt <- c(0,sort(lse$lse$supp$tau), sort(lse$lse$supp$eta), TT) # where h.lse changes slope yy <- sapply(tt, h.lse) # values of h.lse at tt plot(tt, yy, xlim=c(0,TT), type="l", lwd=2, col="red", ylab="hazard", xlab="time", main="LSE (a=0)")