View source: R/generatorDTSD.R
generatorDTSD | R Documentation |
Generate DTSD class objects using a dataframe. The dataframe should include unique identification number for each subject, multiple rows arranged data (contain risk factors, survival time and outcomes) representing observations at different time slices/time points.
generatorDTSD(dataset, periodindex, IDindex, timeindex, statusindex, variable, ifclassifydata=TRUE, predict.time=365, isfill=TRUE )
dataset |
A dataframe of time-series observations, containing identification numbers of each subject, index of time slice, value of risk factors, survival time, and survival outcomes. |
periodindex |
Time slice indicator, represent index of time slice of specific observation, This variable is normally coded by integers, e.g. 0, 1, 2... |
IDindex |
Variable name representing patient identification number. |
timeindex |
Variable name representing follow up time for censored data for each specific observation. |
statusindex |
The status indicator representing the patient's outcome status. For Overall survival, the status is normally coded by the policy 0=alive, 1=dead. |
variable |
List object containing the risk factors required for modeling. |
ifclassifydata |
A logical value, which is optional. Judgment on whether to classify risk factors automatically. When |
predict.time |
Optional, Time of event assessment for identifying the best cutoff using survivalROC. When |
isfill |
Logical value, used to confirm whether to fill in missing data. If it is True, then fill. |
This function return a DTSD class object for conducting survivalpath function. This function facilitate enabling automatic binary classification of continuous variables. When continuous variables need to be classified, survivalROC uses survival data at the predict.time to calculate cutoffs. The cutoff will be used for construction of survival path at all time slices.
return a DTSD class object for survivalpath() function.
time |
|
status |
|
tsdata |
|
tsid |
|
length |
|
ts_size |
List object, representing sample size at each time slice. |
cutoff |
List object, representing cut-off values for each variable used for modeling. |
library(dplyr) data("DTSDHCC") id = DTSDHCC$ID[!duplicated(DTSDHCC$ID)] set.seed(123) id = sample(id,500) miniDTSDHCC <- DTSDHCC[DTSDHCC$ID %in% id,] dataset = timedivision(miniDTSDHCC,"ID","Date",period = 90,left_interval = 0.5,right_interval=0.5) resu <- generatorDTSD(dataset,periodindex="time_slice",IDindex="ID" ,timeindex="OStime_day", statusindex="Status_of_death",variable =c( "Age", "Amount.of.Hepatic.Lesions", "Largest.Diameter.of.Hepatic.Lesions", "New.Lesion","Vascular.Invasion" ,"Local.Lymph.Node.Metastasis", "Distant.Metastasis" , "Child_pugh_score" ,"AFP"),predict.time=365*1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.