Kernel estimate of conditional hazard function for right-censored data with one covariate. Options include two methods for bandwidth selection.
khazardcond(times, delta, covariate, h = NULL, t = NULL, x = NULL,
tx = NULL, t.length = 100, x.length = 100, tmin = NULL,
tmax = NULL, xmin = NULL, xmax = NULL, kernel = "epanechnikov",
type = "interior", type.w = "nw", parallel = FALSE,
h.method = "crossval", optim.method = "ga", tol = ifelse(h.method
== "crossval", 10^(-6), 1), run = 2, ...)vector of observed times
vector of censoring indicator. 0 - censored, 1 - uncensored (dead)
vector of covariate
bandwidth vector of length 2, first element is bandwidth for time and second for covariate. If missing, h is found using some bandwidth selection method.
vector of time points at which estimate is evaluated
vector of covariate points at which estimate is evaluated
data frame of t and x at which estimate is evaluated
number of grid points of time
number of grid points of covariate
minimum/maximum values for grid of time
minimum/maximum values for grid of covariate
kernel function, possible values are: "epanechnikov" (default), "gaussian", "rectangular", "quartic".
Type of kernel estimate. Possible types are: "exterior", "interior" (default).
Type of weights. Default are Nadaraya-Watson weights.
allows parallel computation. Default is FALSE.
method for bandwidth selection. Possible methods are: "crossval" (default), "maxlike".
method for numerical optimization of the crossvalidation or log-likelihood function. Possible methods are: "ga"(default).
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 'khazardcond' which is a list with fields
vector of time points at which estimate is evaluated
vector of covariate points at which estimate is evaluated
matrix of hazard function values on grid or data.frame of time and covariate points and appropriate hazard values if hx is defined
bandwidth vector
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 conditional subdensity of the uncensored observations to the conditional 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 conditional hazard function.
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<-khazardcond(times = lung$time,delta = lung$status-1,covariate = lung$age,h=c(200,20))
# }
Run the code above in your browser using DataLab