LocalKM: Kernel-based Local Kaplan-Meier Estimator

Description Usage Arguments Value Examples

Description

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 > 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 .

Usage

1
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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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"))

QTOCen documentation built on June 4, 2019, 5:03 p.m.

Related to LocalKM in QTOCen...