create_time_svhm: Train Time Dependent SVHM

View source: R/create_time_svhm.R

create_time_svhmR Documentation

Train Time Dependent SVHM

Description

Calculates the Risk score and the value of the prediction function for each individual in the data set.

Usage

create_time_svhm(
  df,
  covariates,
  cost,
  varName_cencored,
  varName_futime,
  start_interval,
  end_interval,
  test_size = 0.3,
  opt = "osqp",
  gamma_squared = 0.5
)

Arguments

df

data frame

covariates

vector of name of covariates

cost

cost parameter to be used

varName_cencored

name of variable in df that indicates cencoring

varName_futime

name of variable in df that indicates event time

start_interval

name of variable that indicates when the interval starts

end_interval

name of variable that indicates when the interval ends

test_size

size of final test set in precent

opt

which quadratic optimization is used (opt='mosek' or opt='osqp')

gamma_squared

width of gaussian kernel

Value

trained model with $e_vec vector indicating if an event happens at each event time $sol calculated optimal solution for each event time $train train dataset with risk scores $test test dataset with risk scores cost cost parameter

Note

In contrast to the create_svhm() function this function does not predict event times!

Examples

{

library(timereg)
library(SVHM)

##############
# Parameters #
##############

opt <- "osqp"
gamma_squared <- 200
test_size=.3
cost <- 16

######################
#  Model prediction  #
######################

data(csl)

time_model <- create_time_svhm(csl, c("sex", "age"), cost, varName_cencored='dc', varName_futime='eventT', start_interval='lt, end_interval='rt, test_size=test_size, opt=opt, gamma_squared=gamma_squared)
}


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