weight_mat: Weight matrix

View source: R/weight_mat_func.r

weight_matR Documentation

Weight matrix

Description

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.

Usage

weight_mat(training_dataset, ordered_event_times)

Arguments

training_dataset

data frame representing the training data

ordered_event_times

data frame of all event times ordered in ascending order

Value

matrix storing all weights for every individual

Examples

{
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)
}


herglola/SVHM documentation built on March 24, 2022, 12:44 p.m.