Survival data is added to an existing data set.

genSurv(dtName, survDefs, digits = 3)

Arguments

dtName

Name of complete data set

survDefs

Definitions of survival

digits

Number of digits for rounding

Value

Original matrix with survival time

Examples

# Baseline data definitions def <- defData(varname = "x1", formula = .5, dist = "binary") def <- defData(def, varname = "x2", formula = .5, dist = "binary") def <- defData(def, varname = "grp", formula = .5, dist = "binary") # Survival data definitions sdef <- defSurv( varname = "survTime", formula = "1.5*x1", scale = "grp*50 + (1-grp)*25", shape = "grp*1 + (1-grp)*1.5" ) sdef <- defSurv(sdef, varname = "censorTime", scale = 80, shape = 1) sdef
#> varname formula scale shape #> 1: survTime 1.5*x1 grp*50 + (1-grp)*25 grp*1 + (1-grp)*1.5 #> 2: censorTime 0 80 1
# Baseline data definitions dtSurv <- genData(300, def) # Add survival times dtSurv <- genSurv(dtSurv, sdef) head(dtSurv)
#> id x1 x2 grp survTime censorTime #> 1: 1 0 1 0 10.865 88.965 #> 2: 2 1 1 1 60.252 49.287 #> 3: 3 1 0 0 5.009 59.099 #> 4: 4 0 0 0 34.043 0.532 #> 5: 5 0 0 1 10.109 101.262 #> 6: 6 1 1 0 113.537 85.093