Simulate Survival Data
rsurv.RdSimulation Setup for Survival Data.
Usage
rsurv(N, model=c("A", "B", "C", "D", "tree"), gamma=NULL, fact=1, pnon=10,
gethaz=FALSE)Arguments
- N
number of observations.
- model
type of model.
- gamma
simulate censoring time as runif(N, 0, gamma). Defaults to
NULL(no censoring).- fact
scale parameter for
model=tree.- pnon
number of additional non-informative variables for the tree model.
- gethaz
logical, indicating wheather the hazard rate for each observation should be returned.
Details
Simulation setup similar to configurations used in LeBlanc and Crowley (1992) or Keles and Segal (2002) as well as a tree model used in Hothorn et al. (2004). See Hothorn et al. (2004) for the details.
Value
A data frame with elements time, cens, X1 ...
X5. If pnon > 0, additional noninformative covariables are
added. If gethaz=TRUE, the hazard attribute returns the hazard
rates.
References
M. LeBlanc and J. Crowley (1992), Relative Risk Trees for Censored Survival Data. Biometrics 48, 411–425.
S. Keles and M. R. Segal (2002), Residual-based tree-structured survival analysis. Statistics in Medicine, 21, 313–326.
Torsten Hothorn, Berthold Lausen, Axel Benner and Martin Radespiel-Troeger (2004), Bagging Survival Trees. Statistics in Medicine, 23(1), 77–91.
Examples
library("survival")
# 3*X1 + X2
simdat <- rsurv(500, model="C")
coxph(Surv(time, cens) ~ ., data=simdat)
#> Call:
#> coxph(formula = Surv(time, cens) ~ ., data = simdat)
#>
#> coef exp(coef) se(coef) z p
#> X1 3.2506 25.8050 0.2017 16.115 < 2e-16
#> X2 1.1106 3.0362 0.1657 6.704 2.03e-11
#> X3 0.2247 1.2520 0.1602 1.403 0.161
#> X4 0.0611 1.0630 0.1630 0.375 0.708
#> X5 -0.1698 0.8438 0.1507 -1.127 0.260
#>
#> Likelihood ratio test=307.4 on 5 df, p=< 2.2e-16
#> n= 500, number of events= 500