generatorDTSD: Instantiate the an object of class Dynamic Time Series Data...

View source: R/generatorDTSD.R

generatorDTSDR Documentation

Instantiate the an object of class Dynamic Time Series Data (DTSD)

Description

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.

Usage

generatorDTSD(dataset,
periodindex,
IDindex,
timeindex,
statusindex,
variable,
ifclassifydata=TRUE,
predict.time=365,
isfill=TRUE
)

Arguments

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 ifclassifydata is TRUE (default is TRUE), survivalROC method is used to find cutoff to dichotomize risk factors.

predict.time

Optional, Time of event assessment for identifying the best cutoff using survivalROC. When ifclassifydata is TRUE, predict.time is used in combination.

isfill

Logical value, used to confirm whether to fill in missing data. If it is True, then fill.

Details

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.

Value

return a DTSD class object for survivalpath() function.

time

time list object; Event time or censoring time for subjects.Each element of the list represents, the event time or censoring time starting from each observation

status

status list object; Indicator of status,normally use 0/1 coding. If death or event,1,otherwise,0. Each element of the list represents, the subject's outcome/event.

tsdata

tsdata list object; Each element of tsdata contains the risk factors listed in variable. Each element of the list represents the data frame of each time slice, normally arranged in ascending order

tsid

tsid list object; patient identification number. Each element of the list represents,the identification number of patient at each time slice

length

time,status,tsdata ,tsid are the same length 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.

Examples

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)


SurvivalPath documentation built on July 4, 2022, 1:05 a.m.