dsps_fit: Fitting (Training) dynamic survival prediction

View source: R/dsps_fit.R

dsps_fitR Documentation

Fitting (Training) dynamic survival prediction

Description

dsp_fit is used to fit the dynamic survival prediction. It allows for both linear and Gaussian kernel as well as two time-discrete kernel, semi-linear and semi-Gaussian kernel as described in the manuscript. A list of estimated parameters are returned.

Usage

dsps_fit(data, kernel, C, sigma = NULL)

Arguments

data

a data frame with time-dependent variables at unique event time points. time, event, subjectid should be included after the leading columns of time-dependent variables (Order doesn't matter). time is the ordered unique event time points. event is the survival status at time (1:event; 0:non-event). subjectid is the unique identifier for subject.

kernel

the kernel to be used; Four types of kernels are currently supported: "linear", "gaussian", "semi_linear", "semi_gaussian"

C

a positive number, the penalty parameter that controls the penalty of mis-classification.

sigma

a positive number, the bandwidth parameter for "gaussian" and "semi_gaussian" kernel.

Value

A list of fitting results that can be passed to function dsp_predict.

Examples


data_list <- sim_data(n=100, er=0.6)

# Keep only at-risk observations
train_data <- data_list$Z %>%
                filter(at_risk == 1) %>%
                select(-at_risk)

fit <- dsps_fit(train_data,
               kernel="semi_linear",
               C=2^0)

fit <- dsps_fit(train_data,
               kernel="semi_gaussian",
               sigma=2^0,
               C=2^0)


Wenyi-Xie/DSP documentation built on Sept. 14, 2022, 10:03 p.m.