View source: R/weight_mat_func.r
weight_mat | R Documentation |
calculates the weights for every individual in the training dataset at every event time. If an individual experiences an event the weight is given by the ratio of at risk subjects with no event to all at risk subjects. If no event is experienced the weight is given by the ratio of one over all at risk subjects.
weight_mat(training_dataset, ordered_event_times)
training_dataset |
data frame representing the training data |
ordered_event_times |
data frame of all event times ordered in ascending order |
matrix storing all weights for every individual
{ training <- data.frame(id =c(1:5), futime= sort(runif(5)), death = c(TRUE, FALSE, FALSE, TRUE, TRUE), Y=c(5,4,3,2,1)), times <- subset(training[training$death==TRUE,], select=sort(futime)) SVHM:::weight_mat(training, times) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.