Description Usage Arguments Value Examples

Add single row to survival definitions

1 |

`dtDefs` |
Definition data.table to be modified |

`varname` |
Variable name |

`formula` |
Covariates predicting survival |

`scale` |
Scale parameter for the Weibull distribution. |

`shape` |
The shape of the Weibull distribution. Shape = 1 for an exponential distribution |

A data.table named dtName that is an updated data definitions table

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
# 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
# Baseline data definitions
dtSurv <- genData(300, def)
# Add survival times
dtSurv <- genSurv(dtSurv, sdef)
head(dtSurv)
``` |

kgoldfeld/simstudy documentation built on Nov. 8, 2018, 7:41 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.