LocalKM function

Kernel-based Local Kaplan-Meier Estimator

Kernel-based Local Kaplan-Meier Estimator

This is the local KM estimator customized for this library to run in batch mode. It returns the estimated conditional survival probabilities given a user specified set of covariate names that the survival time depends on, a.k.a F(T>y0x0).F(T > y_0 \mid x_0).

More specifically, for uncensored data points, we return (1 - tauhat_func()). If the observed data point is censored, then this function returns value -1 as a flag meaning we cannot .

LocalKM(D, bw, NamesCov)

Arguments

  • D: a data.frame with column censor_y, column delta, and additional covaraites.
  • bw: the bandwidth parameter
  • NamesCov: the vector of column names in data.frame D such that the survival time depends on.

Returns

A vector of estimated conditional survival probability evaluated at the observed actual survival time on the same individual

Examples

GenerateData <- function(n) { x1 <- runif(n, min=-0.5,max=0.5) x2 <- runif(n, min=-0.5,max=0.5) error <- rnorm(n, sd= 1) ph <- exp(-0.5+1*(x1+x2))/(1+exp(-0.5 + 1*(x1+x2))) a <- rbinom(n = n, size = 1, prob=ph) c <- 1.5 + + runif(n = n, min=0, max=2) cmplt_y <- pmin(2+x1+x2 + a*(1 - x1 - x2) + (0.2 + a*(1+x1+x2)) * error, 4.4) censor_y <- pmin(cmplt_y, c) delta <- as.numeric(c > cmplt_y) return(data.frame(x1=x1,x2=x2,a=a, censor_y = censor_y, delta=delta)) } n <- 20 D <- GenerateData(n) mean_hat <- LocalKM(D, 5, c("x1","x2"))
  • Maintainer: Yu Zhou
  • License: GPL (>= 2)
  • Last published: 2019-06-04

Useful links