create_svhm | R Documentation |
predicts the event times of a given dataset using cross validation for the cost parameter. Final model includes predicted event times as well as parameters to predict new event times from subject who are not in df. All values of covariates are first normalized to the intervall [0,1] before the SVHM algorithm is applied. The cost parameter for the final model is chosen with the best pearson correlation.
create_svhm( df, covariates, cross_validation_val, cost_grid, varName_cencored, varName_futime, k = 3, test_size = 0.2, opt = "osqp", gamma_squared = 0.5, choose = "c" )
df |
data frame |
covariates |
vector of name of covariates |
cross_validation_val |
number of subset to use for cost optimization |
cost_grid |
grid of all cost parameter to be optoimzed uponl |
varName_cencored |
name of variable in df that indicates cencoring |
varName_futime |
name of variable in df that indicates event time |
k |
integer of how many nearest event times are used to predict the event time (default is 3) |
test_size |
size of final test set in precent |
opt |
which quadratic optimization is used ( |
gamma_squared |
width of gaussian kernel |
choose |
optional parameter which decides if the C-index or the pearson correlation is used to determine the optimal cost parameter. Values are either |
trained model with
$e_vec
vector indicating vector containing information if a subject is at risk or if an event happens. If n are the number of subjects and m the number of event times, then event_vec has length n*m,
$k_mat
kernel matrix,
$sol
calculated optimal solution,
$t_predict
test dataset with risk scores risk
and t_predict
,
$p_corr
pearson correlation of the predicted times
$C_indes
C-Index
The mosek package requires a license
{ library(KMsurv) library(SVHM) ############## # Parameters # ############## gamma_squared <- 100 k <- 1 cross_validation_val <- 3 test_size=.3 cost_grid <- 2^c(-6:6) covariates <- c('z7') ###################### # Model prediction # ###################### data(bmt) model <- create_svhm(bmt, covariates, cross_validation_val, cost_grid, varName_cencored="d3", varName_futime = "t2", k=k, test_size=test_size, opt='osqp', gamma_squared=gamma_squared) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.