td.kw.cr | R Documentation |
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.
td.kw.cr(
X,
Y,
delta,
event.code,
tau,
span = 0.1,
h = NULL,
type = "uniform",
epsilon = 0.01
)
X |
a numeric vector of risk score for each subject. Higher value of |
Y |
a numeric vector of time to event. Same length with |
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 |
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 |
type |
a character value, indicating the type of kernel function used to calculate kernel weights. Default is " |
epsilon |
the precision parameter for weight calculation using neighborhood approximation. If not specified, default will be calculating weights for all right censored points individually. |
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.
Returns the estimated conditional probability of being a case at time tau for the specified event code.
survfit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.