Kernel estimate of (unconditional) hazard function for right-censored data. Options include two methods for bandwidth selection.
khazard(times, delta, h = NULL, t = NULL, t.length = 100,
tmin = NULL, tmax = NULL, kernel = "epanechnikov",
type = "interior", parallel = FALSE, value = "CVML",
h.method = "crossval", optim.method = "optimize",
tol = ifelse(h.method == "crossval", 10^(-6), 1), run = 2, ...)vector of observed times
vector of censoring indicator. 0 - censored, 1 - uncensored (dead)
bandwidth (scalar or vector). If missing, h is found using some bandwidth selection method.
vector of time points at which estimate is evaluated
number of grid points
minimum/maximum values for grid
kernel function, possible values are: "epanechnikov" (default), "gaussian", "rectangular", "quartic".
Type of kernel estimate. Possible types are: "exterior", "interior" (default).
allows parallel computation. Default is FALSE.
If h parameter is vector, this option controls output values. If "CVML" (default), the crossvalidation or log-likelihood values only are calculated. If "hazard", the hazard functions only are calculated. If "both" the crossvalidation or log-likelihood values and hazard function are calculated.
method for bandwidth selection. Possible methods are: "crossval" (default), "maxlike".
method for numerical optimization of the crossvalidation or log-likelihood function. Possible methods are: "optimize" (default), "ga".
the desired accuracy of optimization algorithm
the number of consecutive generations without any improvement in the best fitness value before the GA is stopped.
additional arguments of GA algorithm
Returns an object of class 'khazard' which is a list with fields
vector of time points at which estimate is evaluated
data frame of time points, hazard function values and bandwidth
bandwidth
value of crossvalidation or log-likelihood at h
description of used methods
output of ga, object of class ga-class
External type of kernel estimator is defined as the ratio of kernel estimator of the subdensity of the uncensored observations to the survival function of the observable time. Internal type of kernel estimator is based on a convolution of the kernel function with a nonparametric estimator of the cumulative hazard function (Nelson-Aalen estimator).
Selingerova, I., Dolezelova, H., Horova, I., Katina, S., and Zelinka, J. (2016). Survival of Patients with Primary Brain Tumors: Comparison of Two Statistical Approaches. PloS one, 11(2), e0148733.
# NOT RUN {
library(survival)
fit<-khazard(times = lung$time,delta = lung$status-1)
# }
Run the code above in your browser using DataLab