td.kw.cr: Calculate conditional probability of being a case at time tau

View source: R/td.kw.cr.R

td.kw.crR Documentation

Calculate conditional probability of being a case at time tau

Description

This is key function to estimate the weight, the conditional probability of being a case at time tau given the observed time to event, event status, and prognostic risk score, as described in Wu and Li, 2018.

Usage

td.kw.cr(
  X,
  Y,
  delta,
  event.code,
  tau,
  span = 0.1,
  h = NULL,
  type = "uniform",
  epsilon = 0.01
)

Arguments

X

a numeric vector of risk score for each subject. Higher value of X indicates higher risk of the event. It can be biomarker, a function of multiple biomarker, or predicted cumulative incidence function by other methods. Same length with Y and delta.

Y

a numeric vector of time to event. Same length with X and delta.

delta

a vector of numeric indicator of event type. The primary event you want to study should be coded as 1, the competing event should be coded as 2, and censoring should be coded as 0. Same length with X and Y.

event.code

numeric indicator of event (1), or competing event (2), it specifies you are going to calculate the conditional probability for which event.

tau

a scalar, the prediction horizon at which the prediction is evaluated.

span

a numeric value, the proportion of neighbour observations used in nearest neighbor method, default is 0.1.

h

a numeric value, the bandwidth of kernel weights, defualt is NULL. If not specified, the function will use the value of span to calculate kernel weights. In case both span and h are specified, the function will use h.

type

a character value, indicating the type of kernel function used to calculate kernel weights. Default is "uniform" kernel. Other options are "Epanechnikov" and "normal".

epsilon

the precision parameter for weight calculation using neighborhood approximation. If not specified, default will be calculating weights for all right censored points individually.

Details

This function read in the risk score value X, the time-to-event data Y and censoring indicator delta to estimate the weight, the conditional probability of being a case at time tau when there is competing event. The weight estimation serves for the further prediction accuracy estimation, including AUC, Brier score and so on.

Value

Returns the estimated conditional probability of being a case at time tau for the specified event code.

See Also

survfit


tdROC documentation built on May 29, 2024, 3:47 a.m.

Related to td.kw.cr in tdROC...